function buildDynamicStyle(themebasedfoi)
{
var xmlDef = ''+
' <BarChartStyle width="40" height="30" share_scale="false"'+
' min_value="0.0" max_value="1000000">'+
' <Bar name="white" color="#FF0000" />'+
' <Bar name="black" color="#FFC800" />'+
' <Bar name="asianpi" color="#0000FF" />'+
' <Bar name="amindian" color="#00FF00" />'+
' <Bar name="hispanic" color="#00FFFF" />'+
' </BarChartStyle>'+
'</AdvancedStyle>';
var styleObj = new MVXMLStyle("my_style", xmlDef);
themebasedfoi.addStyle(styleObj);
themebasedfoi.setRenderingStyle("my_style");
}
Note that in the above code we first create the XML representation of the Bar chart style, then use the generic MVXMLStyle class to
actually construct the style object. In fact you can use this approach to create all types of MapViewer styles.
Also note that the attributes share_scale, min_value and max_value in the Bar chart's
XML definition refer to how MapViewer scales the height of the bars (across all bar charts or not). In this case the
height of each bar is determined locally within each bar chart. The overall bar chart size is specified by the
width and height attributes. For more info on Bar chart support please refer to the MapViewer User's Guide.