Esri / cedar

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

Correct syntax for chart overrides #425

Open eastmb opened 6 years ago

eastmb commented 6 years ago

I have a map with a popup link that opens a chart of related data. I want to move beyond the default axis labels and chart colors. I have working code for bar chart color overrides but I'm currently unable to get chart.overrides to work for axis labels.

code - https://github.com/eastmb/DeerHarvest/tree/gh-pages result - https://eastmb.github.io/DeerHarvest/

bar chart marks override (works):

chart.override = { marks: [{ properties: { hover: { fill: { value: "#B80F0F" } }, update: { fill: { value: "#B80F8F" } } } }] };

attempted axis override code (not working):

var overrides = { "categoryAxis": { "labelRotation": 70 } }; chart.overrides = overrides;

benstoltz commented 6 years ago

Hi @eastmb sorry for taking a while to get back to you on this issue. So a few things based on looking at your code. One you're currently using override that should be swapped over to overrides. Secondly you might want to update your version of cedar to 1.0.0-beta.6.

Now there does seem to be a legitimate bug with regards to labelRotation. I'm not quite sure what's going on, but something is mucking up somewhere in the line. But it only seems to be effecting labelRotation. For example this works fine:

"overrides": {
    "categoryAxis": {
      "color": "red"
    }
  }

I'd suggest playing around and seeing what's working and what's not. I'll be digging in further to see what's up with labelRotation.