I want to create a chart with stacked bars and a line, but it just works if I doesn't stack.
Public Class APPBWS_ChartData {
Public String Month { get; set; }
Public Double Data1 { get; set; }
Public Double Data2 { get; set; }
Public Double Data3 { get; set; }
public ChartData(String Month, Double Data1, Double Data2, Double Data3) {
this.Month = Month;
this.Data1 = Data1;
this.Data2 = Data2;
this.Data3 = Data3;
}
}
Public List<ChartData> getData() {
List<ChartData> data = new List<ChartData>();
data.add(new ChartData('Jan', CY_01_APPBWS, CY_01_APPBWS_STO, CY_01_ZS));
data.add(new ChartData('Feb', CY_02_APPBWS, CY_02_APPBWS_STO, CY_02_ZS));
data.add(new ChartData('Mar', CY_03_APPBWS, CY_03_APPBWS_STO, CY_03_ZS));
data.add(new ChartData('Apr', CY_04_APPBWS, CY_04_APPBWS_STO, CY_04_ZS));
data.add(new ChartData('May', CY_05_APPBWS, CY_05_APPBWS_STO, CY_05_ZS));
data.add(new ChartData('Jun', CY_06_APPBWS, CY_06_APPBWS_STO, CY_06_ZS));
data.add(new ChartData('Jul', CY_07_APPBWS, CY_07_APPBWS_STO, CY_07_ZS));
data.add(new ChartData('Aug', CY_08_APPBWS, CY_08_APPBWS_STO, CY_08_ZS));
data.add(new ChartData('Sep', CY_09_APPBWS, CY_09_APPBWS_STO, CY_09_ZS));
data.add(new ChartData('Oct', CY_10_APPBWS, CY_10_APPBWS_STO, CY_10_ZS));
data.add(new ChartData('Nov', CY_11_APPBWS, CY_11_APPBWS_STO, CY_11_ZS));
data.add(new ChartData('Dec', CY_12_APPBWS, CY_12_APPBWS_STO, CY_12_ZS));
return data;
}
<apex:chart height="390" width="950" data="{!Data}">
<apex:barSeries title="Sales" orientation="vertical" axis="left" xField="Month" stacked="true" yField="Data1, Data2" colorSet="#3392d3">
<apex:chartLabel display="outside" field="Data1" minMargin="100" font="bold"/>
</apex:barSeries>
<apex:lineSeries axis="right" fill="true" xField="Month" yField="Data3" markerType="cross" markerSize="4" markerFill="#FF0000"/>
<apex:axis type="Numeric" position="left" fields="Data1" minimum="0" title="" grid="true"/>
<apex:axis type="Numeric" position="right" fields="Data3" minimum="0" title="" grid="true"/>
<apex:axis type="Category" position="bottom" fields="Month" title=""/>
<apex:legend position="bottom"/>
</apex:chart>