Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| wiki:graphs_or_charts [2018/12/30 20:20] – [Step Chart] ttzhou | wiki:graphs_or_charts [2019/03/31 00:37] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| This plugin accepts the same JavaScript object that C3 takes to generate a chart. Any chart describable by a static JavaScript object is supported. All types of charts natively supported by C3 can be rendered, such as line/ | This plugin accepts the same JavaScript object that C3 takes to generate a chart. Any chart describable by a static JavaScript object is supported. All types of charts natively supported by C3 can be rendered, such as line/ | ||
| + | <alert info>To add captions to figures or tables, please see [[: | ||
| ===== Usages ===== | ===== Usages ===== | ||
| Example graphs could be found at [[https:// | Example graphs could be found at [[https:// | ||
| Line 44: | Line 45: | ||
| < | < | ||
| <c3> | <c3> | ||
| - | // some comment | + | |
| - | | + | columns: [ |
| - | columns: [ | + | [' |
| - | [' | + | ], |
| - | [' | + | type : 'bar', |
| - | ], | + | }, |
| - | type : 'line', | + | axis: { |
| - | }, | + | |
| - | axis: { | + | |
| x: { | x: { | ||
| - | type: 'indexed', | + | type: 'category', |
| - | categories: [' | + | categories: [' |
| } | } | ||
| - | } | + | }/c3> |
| - | </c3> | + | |
| </ | </ | ||
| Line 64: | Line 62: | ||
| <c3> | <c3> | ||
| - | // some comment | + | |
| - | | + | columns: [ |
| - | columns: [ | + | [' |
| - | [' | + | ], |
| - | [' | + | type : 'bar', |
| - | ], | + | }, |
| - | type : 'line', | + | axis: { |
| - | }, | + | |
| - | axis: { | + | |
| x: { | x: { | ||
| - | type: 'indexed', | + | type: 'category', |
| - | categories: [' | + | categories: [' |
| } | } | ||
| } | } | ||
| Line 174: | Line 170: | ||
| [' | [' | ||
| ] | ] | ||
| + | } | ||
| + | </c3> | ||
| + | |||
| + | ==== Additional Y Axis ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | axes: { | ||
| + | data1: ' | ||
| + | data2: ' | ||
| + | }, | ||
| + | }, | ||
| + | axis: { | ||
| + | y: { | ||
| + | show: true, | ||
| + | label: 'Axis Y', | ||
| + | }, | ||
| + | y2: { | ||
| + | show: true, | ||
| + | label: 'Axis Y2', | ||
| + | }, | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| + | |||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | axes: { | ||
| + | data1: ' | ||
| + | data2: ' | ||
| + | }, | ||
| + | }, | ||
| + | axis: { | ||
| + | y: { | ||
| + | show: true, | ||
| + | label: 'Axis Y', | ||
| + | }, | ||
| + | y2: { | ||
| + | show: true, | ||
| + | label: 'Axis Y2', | ||
| + | }, | ||
| } | } | ||
| </c3> | </c3> | ||
| Line 275: | Line 322: | ||
| ==== Area Chart ==== | ==== Area Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | types: { | ||
| + | data1: ' | ||
| + | data2: ' | ||
| + | } | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| + | |||
| <c3> | <c3> | ||
| data: { | data: { | ||
| Line 290: | Line 354: | ||
| ==== Stacked Area Chart ==== | ==== Stacked Area Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | types: { | ||
| + | data1: ' | ||
| + | data2: ' | ||
| + | // ' | ||
| + | }, | ||
| + | groups: [[' | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| <c3> | <c3> | ||
| Line 308: | Line 390: | ||
| ==== Bar Chart ==== | ==== Bar Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | type: ' | ||
| + | }, | ||
| + | bar: { | ||
| + | width: { | ||
| + | ratio: 0.5 // this makes bar width 50% of length between ticks | ||
| + | } | ||
| + | // or | ||
| + | //width: 100 // this makes bar width 100px | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| + | |||
| <c3> | <c3> | ||
| data: { | data: { | ||
| Line 327: | Line 431: | ||
| ==== Stacked Bar Chart ==== | ==== Stacked Bar Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | type: ' | ||
| + | groups: [ | ||
| + | [' | ||
| + | [' | ||
| + | ] | ||
| + | }, | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| + | |||
| <c3> | <c3> | ||
| data: { | data: { | ||
| Line 344: | Line 468: | ||
| ==== Scatter Plot ==== | ==== Scatter Plot ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | xs: { | ||
| + | setosa: ' | ||
| + | versicolor: ' | ||
| + | }, | ||
| + | // iris data from R | ||
| + | columns: [ | ||
| + | [" | ||
| + | [" | ||
| + | [" | ||
| + | [" | ||
| + | ], | ||
| + | type: ' | ||
| + | }, | ||
| + | axis: { | ||
| + | x: { | ||
| + | label: ' | ||
| + | tick: { | ||
| + | fit: false | ||
| + | } | ||
| + | }, | ||
| + | y: { | ||
| + | label: ' | ||
| + | } | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| + | |||
| <c3> | <c3> | ||
| data: { | data: { | ||
| Line 374: | Line 530: | ||
| ==== Donut Chart ==== | ==== Donut Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | type : ' | ||
| + | }, | ||
| + | donut: { | ||
| + | title: "Iris Petal Width" | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| <c3> | <c3> | ||
| Line 391: | Line 564: | ||
| ==== Gauge Chart ==== | ==== Gauge Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | ], | ||
| + | type: ' | ||
| + | }, | ||
| + | gauge: { | ||
| + | // label: { | ||
| + | // format: function(value, | ||
| + | // return value; | ||
| + | // }, | ||
| + | // show: false // to turn off the min/max labels. | ||
| + | // }, | ||
| + | // min: 0, // 0 is default, //can handle negative min e.g. vacuum / voltage / current flow / rate of change | ||
| + | // max: 100, // 100 is default | ||
| + | // units: ' %', | ||
| + | // width: 39 // for adjusting arc thickness | ||
| + | }, | ||
| + | color: { | ||
| + | pattern: ['# | ||
| + | threshold: { | ||
| + | // unit: ' | ||
| + | // max: 200, // 100 is default | ||
| + | values: [30, 60, 90, 100] | ||
| + | } | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| <c3> | <c3> | ||
| Line 423: | Line 628: | ||
| ==== Combination Chart ==== | ==== Combination Chart ==== | ||
| + | < | ||
| + | <c3> | ||
| + | data: { | ||
| + | columns: [ | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | [' | ||
| + | ], | ||
| + | type: ' | ||
| + | types: { | ||
| + | data3: ' | ||
| + | data4: ' | ||
| + | data6: ' | ||
| + | }, | ||
| + | groups: [ | ||
| + | [' | ||
| + | ] | ||
| + | }, | ||
| + | axis: { | ||
| + | x: { | ||
| + | type: ' | ||
| + | categories: [' | ||
| + | } | ||
| + | } | ||
| + | </c3> | ||
| + | </ | ||
| + | |||
| + | How the above code looks like in work: | ||
| <c3> | <c3> | ||