Project

General

Profile

csInfo #4057

Updated by Redmine Admin 7 days ago


 {{kroki(vega-lite) 
 { 
   "$schema": "https://vega.github.io/schema/vega-lite/v4.json", 
   "description": "Horizontally concatenated charts that show different types of discretizing scales.", 
   "data": { 
     "values": [ 
       {"a": "A", "b": 28}, 
       {"a": "B", "b": 55}, 
       {"a": "C", "b": 43}, 
       {"a": "D", "b": 91}, 
       {"a": "E", "b": 81}, 
       {"a": "F", "b": 53}, 
       {"a": "G", "b": 19}, 
       {"a": "H", "b": 87}, 
       {"a": "I", "b": 52} 
     ] 
   }, 
   "hconcat": [ 
     { 
       "mark": "circle", 
       "encoding": { 
         "y": { 
           "field": "b", 
           "type": "nominal", 
           "sort": null, 
           "axis": { 
             "ticks": false, 
             "domain": false, 
             "title": null 
           } 
         }, 
         "size": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantize" 
           } 
         }, 
         "color": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantize", 
             "zero": true 
           }, 
           "legend": { 
             "title": "Quantize" 
           } 
         } 
       } 
     }, 
     { 
       "mark": "circle", 
       "encoding": { 
         "y": { 
           "field": "b", 
           "type": "nominal", 
           "sort": null, 
           "axis": { 
             "ticks": false, 
             "domain": false, 
             "title": null 
           } 
         }, 
         "size": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantile", 
             "range": [80, 160, 240, 320, 400] 
           } 
         }, 
         "color": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantile", 
             "scheme": "magma" 
           }, 
           "legend": { 
             "format": "d", 
             "title": "Quantile" 
           } 
         } 
       } 
     }, 
     { 
       "mark": "circle", 
       "encoding": { 
         "y": { 
           "field": "b", 
           "type": "nominal", 
           "sort": null, 
           "axis": { 
             "ticks": false, 
             "domain": false, 
             "title": null 
           } 
         }, 
         "size": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "threshold", 
             "domain": [30, 70], 
             "range": [80, 200, 320] 
           } 
         }, 
         "color": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "threshold", 
             "domain": [30, 70], 
             "scheme": "viridis" 
           }, 
           "legend": { 
             "title": "Threshold" 
           } 
         } 
       } 
     } 
   ], 
   "resolve": { 
     "scale": { 
       "color": "independent", 
       "size": "independent" 
     } 
   } 
 } 
 }} 

 The diagram above is shown by just simply put sample diagram code copied from [kroki.io](https://kroki.io) inside a macro. 
 The macro language is described in [redmine-kroki](https://github.com/JeffDess/redmine-kroki) plugin page. 

 This is the exact code: 
 ``` 

 {{kroki(vega-lite) 
 { 
   "$schema": "https://vega.github.io/schema/vega-lite/v4.json", 
   "description": "Horizontally concatenated charts that show different types of discretizing scales.", 
   "data": { 
     "values": [ 
       {"a": "A", "b": 28}, 
       {"a": "B", "b": 55}, 
       {"a": "C", "b": 43}, 
       {"a": "D", "b": 91}, 
       {"a": "E", "b": 81}, 
       {"a": "F", "b": 53}, 
       {"a": "G", "b": 19}, 
       {"a": "H", "b": 87}, 
       {"a": "I", "b": 52} 
     ] 
   }, 
   "hconcat": [ 
     { 
       "mark": "circle", 
       "encoding": { 
         "y": { 
           "field": "b", 
           "type": "nominal", 
           "sort": null, 
           "axis": { 
             "ticks": false, 
             "domain": false, 
             "title": null 
           } 
         }, 
         "size": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantize" 
           } 
         }, 
         "color": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantize", 
             "zero": true 
           }, 
           "legend": { 
             "title": "Quantize" 
           } 
         } 
       } 
     }, 
     { 
       "mark": "circle", 
       "encoding": { 
         "y": { 
           "field": "b", 
           "type": "nominal", 
           "sort": null, 
           "axis": { 
             "ticks": false, 
             "domain": false, 
             "title": null 
           } 
         }, 
         "size": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantile", 
             "range": [80, 160, 240, 320, 400] 
           } 
         }, 
         "color": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "quantile", 
             "scheme": "magma" 
           }, 
           "legend": { 
             "format": "d", 
             "title": "Quantile" 
           } 
         } 
       } 
     }, 
     { 
       "mark": "circle", 
       "encoding": { 
         "y": { 
           "field": "b", 
           "type": "nominal", 
           "sort": null, 
           "axis": { 
             "ticks": false, 
             "domain": false, 
             "title": null 
           } 
         }, 
         "size": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "threshold", 
             "domain": [30, 70], 
             "range": [80, 200, 320] 
           } 
         }, 
         "color": { 
           "field": "b", 
           "type": "quantitative", 
           "scale": { 
             "type": "threshold", 
             "domain": [30, 70], 
             "scheme": "viridis" 
           }, 
           "legend": { 
             "title": "Threshold" 
           } 
         } 
       } 
     } 
   ], 
   "resolve": { 
     "scale": { 
       "color": "independent", 
       "size": "independent" 
     } 
   } 
 } 
 }} 
 ```

Back