{{name}}
4 |{{desc}}
5 |├── .browserslistrc
├── docsrc
├── src
│ ├── assets
│ │ └── styles
│ │ │ ├── _index.scss
│ │ │ ├── main.scss
│ │ │ └── reset.scss
│ ├── App.vue
│ ├── components
│ │ ├── examples
│ │ │ ├── PieChartExamples.vue
│ │ │ ├── LineChartExamples.vue
│ │ │ ├── SlopeChartExamples.vue
│ │ │ ├── BarChartExamples.vue
│ │ │ ├── SlopeChartExampleBasic.vue
│ │ │ ├── SlopeChartExampleHighlight.vue
│ │ │ ├── SlopeChartExampleColors.vue
│ │ │ ├── BarChartExampleHorizontal.vue
│ │ │ ├── LineChartExampleBasic.vue
│ │ │ ├── BarChartExampleGroup.vue
│ │ │ ├── LineChartExampleCustomization.vue
│ │ │ ├── PieChartExampleDataUpdate.vue
│ │ │ ├── SlopeChartExampleDataUpdate.vue
│ │ │ ├── BarChartExampleDataUpdate.vue
│ │ │ ├── LineChartExampleUpdate.vue
│ │ │ ├── BarChartExampleTooltipOverride.vue
│ │ │ └── BarChartExampleBasic.vue
│ │ ├── HeaderComponent.vue
│ │ ├── ChartTitleComponent.vue
│ │ ├── ChartTemplateComponent.vue
│ │ ├── ChartImportComponent.vue
│ │ ├── ChartDataComponent.vue
│ │ ├── ChartStylesComponent.vue
│ │ ├── FooterComponent.vue
│ │ ├── ChartIndexComponent.vue
│ │ ├── index.js
│ │ └── ChartColorComponent.vue
│ ├── main.js
│ ├── views
│ │ ├── Examples.vue
│ │ ├── SlicesChart.vue
│ │ ├── BarChart.vue
│ │ ├── PieChart.vue
│ │ ├── SlopeChart.vue
│ │ ├── Home.vue
│ │ ├── WordsCloud.vue
│ │ ├── Sunburst.vue
│ │ └── LineChart.vue
│ └── router
│ │ └── index.js
├── public
│ ├── favicon.ico
│ ├── index.html
│ └── img
│ │ └── icons
│ │ ├── D3BarChart.svg
│ │ ├── D3PieChart.svg
│ │ ├── D3SlopeChart.svg
│ │ ├── D3LineChart.svg
│ │ ├── D3Sunburst.svg
│ │ └── D3SlicesChart.svg
├── babel.config.js
├── vue.config.js
└── package.json
├── docs
├── favicon.ico
├── public
│ ├── css
│ │ ├── chunk-44b11179.71b8c2da.css
│ │ └── chunk-vendors.a4338027.css
│ └── js
│ │ ├── chunk-2d2082c5.86c27c45.js
│ │ ├── chunk-2d0df447.c5f955b4.js
│ │ ├── chunk-44b11179.1a9686cd.js
│ │ ├── chunk-2d0be166.0e330607.js
│ │ ├── chunk-74b0551a.a3d50613.js
│ │ ├── chunk-2d0e62b7.4876b9fb.js
│ │ ├── chunk-2d0a387d.1561b119.js
│ │ ├── chunk-b7d79802.be2d9b19.js
│ │ ├── chunk-2d2082c5.86c27c45.js.map
│ │ ├── chunk-2d0df447.c5f955b4.js.map
│ │ ├── chunk-74b0551a.a3d50613.js.map
│ │ └── chunk-2d0be166.0e330607.js.map
├── index.html
└── img
│ └── icons
│ ├── D3BarChart.svg
│ ├── D3PieChart.svg
│ ├── D3SlopeChart.svg
│ ├── D3LineChart.svg
│ ├── D3Sunburst.svg
│ └── D3SlicesChart.svg
├── babel.config.js
├── .gitignore
├── src
├── barchart
│ └── d3.barchart.vue
├── sunburst
│ └── d3.sunburst.vue
├── linechart
│ └── d3.linechart.vue
├── wordscloud
│ ├── d3.wordscloud.vue
│ └── d3.wordscloud.js
├── sliceschart
│ └── d3.sliceschart.vue
├── index.js
├── piechart
│ └── d3.piechart.vue
├── slopechart
│ └── d3.slopechart.vue
├── entry.js
├── styles.scss
├── d3.chart.vue
└── d3.chart.js
├── README.md
├── package.json
└── CONTRIB.md
/.browserslistrc:
--------------------------------------------------------------------------------
1 | current node
2 | last 2 versions and > 2%
3 | ie > 10
4 |
--------------------------------------------------------------------------------
/docsrc/src/assets/styles/_index.scss:
--------------------------------------------------------------------------------
1 | @import './reset';
2 | @import './main';
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Saigesp/vue-d3-charts/HEAD/docs/favicon.ico
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@babel/preset-env',
4 | ],
5 | };
6 |
--------------------------------------------------------------------------------
/docsrc/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Saigesp/vue-d3-charts/HEAD/docsrc/public/favicon.ico
--------------------------------------------------------------------------------
/docsrc/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/cli-plugin-babel/preset'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/docsrc/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 | A D3 charts module for Vue {{desc}}Pie chart examples
4 | Line chart examples
4 |
5 | Slope chart examples
4 | Bar chart examples
4 | {{name}}
4 |
{{template}}Note that title, source and height are others accepted props.
{{chartcode}}See source code.
6 |. Fields can be changed in configuration. Example:
5 |{{code}}To work with this data, configuration must be .
7 |Default styles can be easily overrided with BEM modifiers notation:
5 |.chart{
7 | &--{{classname}} {
8 | font-size: 10px;
9 | }
10 | &__{{el}}--{{classname}} {
11 | /* your styles */
12 | }
13 | }
14 | Note that SVG elements use some special properties in CSS. 16 | More info.
17 |Select chart to see code examples
7 |{{codehtml}}{{codejs}}{{codehtml}}{{codejs}}key: "name", value: "total"'}}},s=n,l=o("2877"),i=Object(l["a"])(s,e,c,!1,null,null,null);a["default"]=i.exports}}]);
2 | //# sourceMappingURL=chunk-2d0df447.c5f955b4.js.map
--------------------------------------------------------------------------------
/docsrc/src/components/examples/SlopeChartExampleColors.vue:
--------------------------------------------------------------------------------
1 |
2 | {{codehtml}}{{codejs}}{{desc}}
5 |{{codehtml}}{{codejs}}key: "name", value: "total"'}}},i=n,s=(e("5033"),e("2877")),l=Object(s["a"])(i,o,r,!1,null,null,null);a["default"]=l.exports},b4c9:function(t,a,e){}}]);
2 | //# sourceMappingURL=chunk-44b11179.1a9686cd.js.map
--------------------------------------------------------------------------------
/docs/public/js/chunk-2d0be166.0e330607.js:
--------------------------------------------------------------------------------
1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0be166"],{"2f84":function(a,t,e){"use strict";e.r(t);var n=function(){var a=this,t=a.$createElement,e=a._self._c||t;return e("div",{staticClass:"page"},[e("ChartTitleComponent",{attrs:{name:a.chartname,desc:a.chartdesc}}),e("section",{staticClass:"chart"},[e("D3Sunburst",{attrs:{config:a.chartconfig,datum:a.chartdata,title:"Lorem ipsum dolor sit amet"}})],1),e("ChartImportComponent",{attrs:{code:a.chartname,link:"https://github.com/Saigesp/vue-d3-charts/blob/master/src/sunburst/d3.sunburst.js"}}),e("ChartTemplateComponent",{attrs:{template:a.chartcode}}),e("ChartDataComponent",{attrs:{desc:a.chartdatadesc,code:a.chartdatacode,config:a.chartdataconfig}}),e("ChartConfigComponent",{attrs:{options:a.chartoptions}}),e("ChartColorComponent"),e("ChartStylesComponent",{attrs:{classname:"sunburst"}})],1)},r=[],o=e("2dd5"),c={name:"Sunburst",components:{D3Sunburst:o["f"]},data:function(){return{chartname:"D3Sunburst",chartdesc:"A sunburst is used to visualize hierarchical data, depicted by concentric circles.",chartcode:'key: "name", value: "value"'}},mounted:function(){var a=this;setTimeout((function(){a.chartdata=[{name:"one",children:[{name:"two",children:[{name:"lorem",value:938},{name:"ipsum",value:3812}]},{name:"four",value:2354}]}]}),2e3),setTimeout((function(){a.chartdata=[{name:"one",children:[{name:"two",children:[{name:"dolor",value:1500},{name:"lorem",value:938},{name:"ipsum",value:3812}]},{name:"four",value:2354}]}]}),4e3),setTimeout((function(){a.chartdata=[{name:"one",children:[{name:"two",children:[{name:"dolor",value:1500},{name:"lorem",value:938}]},{name:"four",value:2354}]}]}),6e3)}},u=c,s=e("2877"),i=Object(s["a"])(u,n,r,!1,null,null,null);t["default"]=i.exports}}]);
2 | //# sourceMappingURL=chunk-2d0be166.0e330607.js.map
--------------------------------------------------------------------------------
/docs/img/icons/D3PieChart.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
70 |
--------------------------------------------------------------------------------
/docsrc/public/img/icons/D3PieChart.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
70 |
--------------------------------------------------------------------------------
/docs/public/js/chunk-74b0551a.a3d50613.js:
--------------------------------------------------------------------------------
1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-74b0551a"],{89463:function(t,a,e){"use strict";e.r(a);var o=function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"page"},[e("ChartTitleComponent",{attrs:{name:t.chartname,desc:t.chartdesc}}),e("section",{staticClass:"chart"},[e("D3BarChart",{attrs:{config:t.chartconfig,datum:t.chartdata,title:"Lorem ipsum",source:"Dolor sit amet"}})],1),e("ChartImportComponent",{attrs:{code:t.chartname,link:"https://github.com/Saigesp/vue-d3-charts/blob/master/src/barchart/d3.barchart.js"}}),e("ChartTemplateComponent",{attrs:{template:t.chartcode}}),e("ChartDataComponent",{attrs:{desc:t.chartdatadesc,code:t.chartdatacode,config:t.chartdataconfig}}),e("ChartConfigComponent",{attrs:{options:t.chartoptions,custom:t.chartcustomoptions}}),e("ChartColorComponent"),e("ChartStylesComponent",{attrs:{classname:"barchart",elements:["bar","label"]}}),e("BarChartExamples")],1)},r=[],n=e("2dd5"),c={name:"BarChart",components:{D3BarChart:n["a"]},data:function(){return{chartname:"D3BarChart",chartdesc:"A bar chart presents categorical data with rectangular bars with heights proportional to the values that they represent.",chartcode:'label: object field to override the label in the tooltip. If set to false, label will be the key field.",example:'tooltip: { label: "displayName" }'}},chartconfig:{key:"name",values:["total"],color:{current:"#41B882"},axis:{yTitle:"Lorem ipsum dolor sit amet",yTicks:10,yFormat:".0s"},transition:{ease:"easeBounceOut",duration:1e3}},chartdata:[{name:"1992",total:4748},{name:"1993",total:5526},{name:"1994",total:8574},{name:"1995",total:15805},{name:"1996",total:14582},{name:"1997",total:26694},{name:"1998",total:35205},{name:"1999",total:45944},{name:"2000",total:78595},{name:"2001",total:78530},{name:"2002",total:45407},{name:"2003",total:54044},{name:"2004",total:69165},{name:"2005",total:61798},{name:"2006",total:63686}],chartdatadesc:"An objects array is expected, with each object as a bar",chartdatacode:'chart_data = [{\n name: "Lorem",\n total: 30\n},{\n name: "Ipsum",\n total: 21\n},{\n name: "Dolor",\n total: 20\n}]',chartdataconfig:'key: "name", values: ["total"]'}}},l=c,s=e("2877"),i=Object(s["a"])(l,o,r,!1,null,null,null);a["default"]=i.exports}}]);
2 | //# sourceMappingURL=chunk-74b0551a.a3d50613.js.map
--------------------------------------------------------------------------------
/docsrc/src/views/SlicesChart.vue:
--------------------------------------------------------------------------------
1 |
2 | angle: [-90, -45, 0, 45, 90]"}},chartconfig:{key:"word",value:"size",color:{scheme:"schemeTableau10"},angle:[0,90]},chartdata:[{word:"Lorem",size:60},{word:"Ipsum",size:10},{word:"Dolor",size:20},{word:"Sit",size:50},{word:"Amet",size:30}],chartdatadesc:"An objects array is expected, with each object as a words",chartdatacode:'chart_data = [{\n word: "Lorem",\n size: 30\n},{\n word: "Ipsum",\n size: 23\n},{\n word: "Dolor",\n size: 64\n}]',chartdataconfig:'key: "word", value: "size"'}},mounted:function(){var t=this;setTimeout((function(){t.chartdata=t.chartdata.concat([{word:"Consectetur",size:20},{word:"Adipiscing",size:30},{word:"Elit",size:10}])}),2e3),setTimeout((function(){t.chartdata=t.chartdata.concat([{word:"Sed",size:12},{word:"Do",size:20},{word:"Eiusmod",size:40},{word:"Tempor",size:45},{word:"Incididunt",size:30}])}),4e3),setTimeout((function(){t.chartdata=t.chartdata.concat([{word:"Ut",size:20},{word:"Labore",size:60},{word:"Et",size:15},{word:"Dolore",size:35},{word:"Magna",size:50},{word:"Aliqua",size:25}])}),6e3)}},d=c,n=a("2877"),i=Object(n["a"])(d,e,r,!1,null,null,null);o["default"]=i.exports}}]);
2 | //# sourceMappingURL=chunk-2d0e62b7.4876b9fb.js.map
--------------------------------------------------------------------------------
/docsrc/src/components/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 |
3 | // Page components
4 | Vue.component('HeaderComponent', require('./HeaderComponent').default);
5 | Vue.component('FooterComponent', require('./FooterComponent').default);
6 | Vue.component('ChartIndexComponent', require('./ChartIndexComponent').default);
7 |
8 | // Chart's documentation components
9 | Vue.component('ChartStylesComponent', require('./ChartStylesComponent').default);
10 | Vue.component('ChartColorComponent', require('./ChartColorComponent').default);
11 | Vue.component('ChartConfigComponent', require('./ChartConfigComponent').default);
12 | Vue.component('ChartDataComponent', require('./ChartDataComponent').default);
13 | Vue.component('ChartTemplateComponent', require('./ChartTemplateComponent').default);
14 | Vue.component('ChartImportComponent', require('./ChartImportComponent').default);
15 | Vue.component('ChartTitleComponent', require('./ChartTitleComponent').default);
16 |
17 | // Charts examples
18 | Vue.component('SlopeChartExamples', require('./examples/SlopeChartExamples').default);
19 | Vue.component('SlopeChartExampleBasic', require('./examples/SlopeChartExampleBasic').default);
20 | Vue.component('SlopeChartExampleHighlight', require('./examples/SlopeChartExampleHighlight').default);
21 | Vue.component('SlopeChartExampleColors', require('./examples/SlopeChartExampleColors').default);
22 | Vue.component('SlopeChartExampleDataUpdate', require('./examples/SlopeChartExampleDataUpdate').default);
23 |
24 | Vue.component('LineChartExamples', require('./examples/LineChartExamples').default);
25 | Vue.component('LineChartExampleBasic', require('./examples/LineChartExampleBasic').default);
26 | Vue.component('LineChartExampleUpdate', require('./examples/LineChartExampleUpdate').default);
27 | Vue.component('LineChartExampleCustomization', require('./examples/LineChartExampleCustomization').default);
28 |
29 | Vue.component('BarChartExamples', require('./examples/BarChartExamples').default);
30 | Vue.component('BarChartExampleBasic', require('./examples/BarChartExampleBasic').default);
31 | Vue.component('BarChartExampleTooltipOverride', require('./examples/BarChartExampleTooltipOverride').default);
32 | Vue.component('BarChartExampleGroup', require('./examples/BarChartExampleGroup').default);
33 | Vue.component('BarChartExampleDataUpdate', require('./examples/BarChartExampleDataUpdate').default);
34 | Vue.component('BarChartExampleHorizontal', require('./examples/BarChartExampleHorizontal').default);
35 |
36 | Vue.component('PieChartExamples', require('./examples/PieChartExamples').default);
37 | Vue.component('PieChartExampleDataUpdate', require('./examples/PieChartExampleDataUpdate').default);
38 |
--------------------------------------------------------------------------------
/docs/public/js/chunk-2d0a387d.1561b119.js:
--------------------------------------------------------------------------------
1 | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0a387d"],{"0326":function(t,a,e){"use strict";e.r(a);var o=function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"page"},[e("ChartTitleComponent",{attrs:{name:t.chartname,desc:t.chartdesc}}),e("section",{staticClass:"chart"},[e("D3LineChart",{attrs:{config:t.chartconfig,datum:t.chartdata,title:"Lorem ipsum dolor sit amet",source:"Custom source"}})],1),e("ChartImportComponent",{attrs:{code:t.chartname,link:"https://github.com/Saigesp/vue-d3-charts/blob/master/src/linechart/d3.linechart.js"}}),e("ChartTemplateComponent",{attrs:{template:t.chartcode}}),e("ChartDataComponent",{attrs:{desc:t.chartdatadesc,code:t.chartdatacode,config:t.chartdataconfig}}),e("ChartConfigComponent",{attrs:{options:t.chartoptions,custom:t.chartcustomoptions}}),e("ChartColorComponent"),e("ChartStylesComponent",{attrs:{classname:"linechart"}}),e("LineChartExamples")],1)},n=[],r=e("2dd5"),c={name:"LineChart",components:{D3LineChart:r["b"]},data:function(){return{chartname:"D3LineChart",chartdesc:"A line chart displays information as a series of data points connected by line segments, usually to visualize a trends over time.",chartcode:'values: ["Iphone", "Android"]'},date:{required:!0,example:'date: { key: "date", inputFormat: "%Y", outputFormat: "%Y"}'},axis:{default:'axis: {\n yTitle: false,\n xTitle: false,\n yFormat: ".0f",\n xFormat: "%Y-%m-%d",\n yTicks: 5,\n xTicks: 3\n }'},margin:{default:"margin: {\n top: 20,\n right: 20,\n bottom: 20,\n left: 40\n }"}},chartconfig:{values:["hours","production"],date:{key:"date",inputFormat:"%Y",outputFormat:"%Y"},tooltip:{labels:["Hour","Production"]},axis:{yFormat:".0f",yTicks:10,yTitle:"Lorem ipsum"},color:{scheme:["#41B882","#222f3e"]},curve:"curveCardinal",transition:{ease:"easeBounceOut",duration:1e3}},chartdata:[{hours:238,production:134,date:2e3},{hours:938,production:478,date:2001},{hours:1832,production:1392,date:2002},{hours:2092,production:2343,date:2003},{hours:2847,production:2346,date:2004},{hours:2576,production:2233,date:2005},{hours:2524,production:2325,date:2006},{hours:1648,production:2456,date:2007},{hours:2479,production:2329,date:2008},{hours:3200,production:2438,date:2009}],chartdatadesc:"An objects array is expected, with each object as an interval in the horizontal axis",chartdatacode:'chart_data = [{\n "iphone": 123,\n "android": 208,\n "when": "2019-08-01"\n},{\n "iphone": 165,\n "android": 201,\n "when": "2019-09-01"\n}]',chartdataconfig:'date: { key: "when", inputFormat: "%Y-%m-%d"}, values: ["iphone","android"]'}}},i=c,s=e("2877"),d=Object(s["a"])(i,o,n,!1,null,null,null);a["default"]=d.exports}}]);
2 | //# sourceMappingURL=chunk-2d0a387d.1561b119.js.map
--------------------------------------------------------------------------------
/docsrc/src/components/examples/LineChartExampleBasic.vue:
--------------------------------------------------------------------------------
1 |
2 | {{codehtml}}{{codejs}}{{desc}}
5 |{{codehtml}}{{codejs}}{{codehtml}}{{codejs}}{{desc}}
5 |{{codehtml}}{{codejs}}{{desc}}
5 |{{codehtml}}{{codejs}}{{desc}}
5 |{{codehtml}}{{codejs}}axis: {titles: ["Yesterday", "Today"]}'},margin:{default:"margin: {\n top: 10,\n right: 100,\n bottom: 20,\n left: 100\n }"}},chartconfig:{key:"name",currentKey:"Lorem",color:{current:"#41B882"},axis:{titles:["2000","2015"]},transition:{ease:"easeBounceOut",duration:1e3}},chartdata:[{start:5355,end:5855,name:"Lorem"},{start:6160,end:6510,name:"Ipsum"},{start:3029,end:5138,name:"Dolor"},{start:2116,end:2904,name:"Sit"},{start:3503,end:4408,name:"Amet"}],chartdatadesc:"An objects array is expected, with each object as a line",chartdatacode:'chart_data = [{\n yesterday: 5355,\n today: 5855,\n name: "Lorem"\n},{\n yesterday: 6160,\n today: 6510,\n name: "Ipsum"\n}]',chartdataconfig:'key: "name", values: ["yesterday","today"]'}},mounted:function(){var t=this;setTimeout((function(){t.chartdata=t.chartdata.filter((function(t){return"Lorem"!=t.name})),t.chartdata.push({start:5085,end:9321,name:"Lorem"})}),2e3),setTimeout((function(){t.chartdata=t.chartdata.filter((function(t){return"Sit"!=t.name}))}),4e3),setTimeout((function(){t.chartdata=t.chartdata.concat([{start:7500,end:9960,name:"Aperiam"}])}),6e3)}},s=c,i=e("2877"),d=Object(i["a"])(s,n,r,!1,null,null,null);a["default"]=d.exports}}]);
2 | //# sourceMappingURL=chunk-b7d79802.be2d9b19.js.map
--------------------------------------------------------------------------------
/docs/img/icons/D3LineChart.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
89 |
--------------------------------------------------------------------------------
/docsrc/public/img/icons/D3LineChart.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
89 |
--------------------------------------------------------------------------------
/docsrc/src/components/examples/LineChartExampleUpdate.vue:
--------------------------------------------------------------------------------
1 |
2 | {{codehtml}}{{codejs}}npm i vue-d3-charts --savevue-d3-charts is a charts library build with reusability in mind. It has evolved from a personal bl.ocks collection to a modular charts system, to allow quick implementation and customatization.
16 |vue-d3-charts is built on top of d3.js and vue.js and is an open source project started by Saigesp under GNU General Public License v3.0. See contribution guide if you want to contribute.
17 |First import your desired charts:
22 |import { D3BarChart } from 'vue-d3-charts';
24 |
25 | export default {
26 | name: 'LoremIpsumComponent',
27 | components: {
28 | D3BarChart,
29 | },
30 | // ...
31 | };
32 | And then use it on your project, passing them a configuratioin object and a data array:
34 |{{bartext}}Each chart has it's own configuration options. For example, the bar chart has these:
36 |chart_config = {
38 | key: 'name',
39 | value: 'total',
40 | color: {current:'#41B882'},
41 | transition: {ease: 'easeBounceOut', duration: 1000}
42 | }
43 | Each chart has its own features, but these are across all charts:
51 |{{desc}}
5 |{{codehtml}}{{codejs}}{{desc}}
5 |{{codehtml}}{{codejs}}This chart has different color configurations that can me combined and used together.
5 | 6 | 7 |Object field to use as a color. This option overrides all other options.
9 |chart_data = [
11 | {name: 'Anna', teamColor: '#55D6BE'},
12 | {name: 'Mikel', teamColor: '#00FF35'},
13 | ]
14 |
15 | chart_config = {
16 | color: {
17 | key: 'teamColor',
18 | },
19 | }
20 | If currentKey isn't set, set all the object's color to passed value.
chart_config = {
28 | color: {
29 | current: 'blue',
30 | },
31 | }
32 | If currentKey is set, overrides the selected object matched by its key and currentKey values, and set not matching objects to default color.
chart_config = {
40 | key: 'name',
41 | currentKey: 'John',
42 | color: {
43 | current: 'green',
44 | default: 'grey',
45 | }
46 | }
47 | current key overrides color scheme and color keys set up values only on matched items.
If set, a the passed color scale will be used as default (this can be overrided by color keys or current key).
54 |If the passed value is a string, (example: 'schemeCategory10') a d3 scale chromatic color scheme will be used. Some example options are schemeAccent, schemeDark2, schemePaired or schemeSet1. These color schemes are colorblind safe, so colorblind people won't be confused reading the chart. Read more.
chart_config = {
57 | color: {
58 | scheme: 'schemeSet1',
59 | },
60 | }
61 | If the passed value is an array, a custom color scale will be used.
63 |chart_config = {
65 | color: {
66 | scheme: ['#55D6BE', '#ACFCD9', '#7D5BA6', '#DDDDDD', '#FC6471'],
67 | },
68 | }
69 | Fancy color palettes can be generated easily with Coolors.
71 | 72 | 73 | 74 |Key-values color overrider. If you want to override the color scheme, you can pass an object colorKeys in configuration. When a item key matches one, the color will be overrided (Note that the key field has to be the same as passed in configuration).
chart_config = {
78 | color: {
79 | keys: {
80 | 'Success': '#339900',
81 | 'Warning': '#ffcc00',
82 | 'Error': '#cc3300',
83 | },
84 | },
85 | }
86 | Note that color.scheme, color.keys and currentKey can be used together.
Select chart to see code examples
\n