/** By default the row chart uses "keyAccessor" as its "colorAccessor", so that next bar's color is the next color from the palette.* This code snippet changes row chart's coloring mode to make it the same as map widget's coloring, where bars are colored* according to their value.* 2017-02-06 Piotr Szrajber <piotr.szrajber@hexagongeospatial.com>*///gsp.ready(function(gsp) { /* uncomment for pasting in browser's javascript console */getWidgets(changeColors);functiongetWidgets(callback){/* find the first choropleth and the first row chart - modify this function according to your needs... */gsp.bi.stage.findWidgets({descriptors:[{chartM:{chart:"choropleth"}},{chartM:{chart:"row"}}]},function(widgets){if(widgets&&widgets[0]&&widgets[0][0]&&widgets[1]&&widgets[1][0])callback(widgets);elsesetTimeout(getWidgets,300);});}functionchangeColors(widgets){varchoropleth=widgets[0][0],rowChart=widgets[1][0];varmapColors=choropleth.chart.colors();rowChart.chart.colors(mapColors);rowChart.chart.colorAccessor(rowChart.chart.valueAccessor());rowChart.chart.redraw();}//}) /* uncomment for pasting in browser's javascript console */
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.