Esri / cedar

JavaScript Charts for ArcGIS
https://esri.github.io/cedar
256 stars 238 forks source link

change color of data series #474

Open zhengniu opened 3 years ago

zhengniu commented 3 years ago

Hi,

any one can help to explain how to use "overrides" to customize colors of data series? I want to change color of each line plot to new colors as below. but seems like "overrides" has no properties for series.
thanks alot for your help

"style": {"colors": ["#b2e2e2"]}, "style": {"colors": ["#edf8fb"]}, "style": {"colors": ["#66c2a4"]}, "style": {"colors": ["#238b45"]}, "style": {"colors": ["#fef0d9"]}, "style": {"colors": ["#fdcc8a"]}, "style": {"colors": ["#fc8d59"]}, "style": {"colors": ["#d7301f"]},

{ "type": "line", "datasets": [ { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/ArcGIS/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 AM ATS Truck EB", "query": { "where": "hwy_num = '401' and dir=1 and type='truck'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "am_ats", "outStatisticFieldName": "am_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 PM ATS Truck EB", "query": { "where": "hwy_num = '401' and dir =1 and type='truck'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "pm_ats", "outStatisticFieldName": "pm_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 AM ATS Truck WB", "query": { "where": "hwy_num = '401' and dir =-1 and type='truck'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "am_ats", "outStatisticFieldName": "am_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 PM ATS Truck WB", "query": { "where": "hwy_num = '401' and dir =-1 and type='truck'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "pm_ats", "outStatisticFieldName": "pm_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/ArcGIS/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 AM ATS Car EB", "query": { "where": "hwy_num = '401' and dir=1 and type='car'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "am_ats", "outStatisticFieldName": "am_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 PM ATS Car EB", "query": { "where": "hwy_num = '401' and dir =1 and type='car'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "pm_ats", "outStatisticFieldName": "pm_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 AM ATS Car WB", "query": { "where": "hwy_num = '401' and dir =-1 and type='car'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "am_ats", "outStatisticFieldName": "am_ats" } ] }, "join": "week" }, { "url": "https://services.arcgis.com/6iGx1Dq91oKtcE7x/arcgis/rest/services/bi_dirGGH_car_truck_weekly/FeatureServer/0", "name": "401 PM ATS Car WB", "query": { "where": "hwy_num = '401' and dir =-1 and type='car'", "orderByFields": "week", "groupByFieldsForStatistics": "week", "outStatistics": [ { "statisticType": "sum", "onStatisticField": "pm_ats", "outStatisticFieldName": "pm_ats" } ] }, "join": "week" } ], "series": [ { "category": { "field": "week", "label": "Week" }, "value": { "field": "am_ats", "label": "401 EB AM ATS Truck" }, "source": "401 AM ATS Truck EB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "pm_ats", "label": "401 EB PM ATS Truck" }, "source": "401 PM ATS Truck EB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "am_ats", "label": "401 WB AM ATS Truck" }, "source": "401 AM ATS Truck WB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "pm_ats", "label": "401 WB PM ATS Truck" }, "source": "401 PM ATS Truck WB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "am_ats", "label": "401 EB AM ATS Car" }, "source": "401 AM ATS Car EB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "pm_ats", "label": "401 EB PM ATS Car" }, "source": "401 PM ATS Car EB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "am_ats", "label": "401 WB AM ATS Car" }, "source": "401 AM ATS Car WB" }, { "category": { "field": "week", "label": "Week" }, "value": { "field": "pm_ats", "label": "401 WB PM ATS Car" }, "source": "401 PM ATS Car WB" } ], "overrides": { "valueAxes": [ { "title": "Speed (km/hr)" } ], "categoryAxis": { "title": "Week", "guides": [ { "category": "Mar-16 to Mar-20", "lineColor": "#CC0000", "lineAlpha": 1, "dashLength": 2, "inside": true, "labelRotation": 90, "label": "State of Emergency" }, { "category": "May-11 to May-15", "lineColor": "#CC0000", "lineAlpha": 1, "dashLength": 2, "inside": true, "labelRotation": 90, "label": "Stage 1 - reopening" }, { "category": "Jun-08 to Jun-12", "lineColor": "#CC0000", "lineAlpha": 1, "dashLength": 2, "inside": true, "labelRotation": 90, "label": "Stage 2 - reopening" }, { "category": "Jul-13 to Jul-17", "lineColor": "#CC0000", "lineAlpha": 1, "dashLength": 2, "inside": true, "labelRotation": 90, "label": "Stage 3 - reopening" } ] } } }