I am using the following code adapted from post "Adding an average line to a stack chart". Although there are no errors i am not seeing any data in the chart. If connected to the datasource as a StackedColumnChart instead of a composite chart all is fine (absent the average line chart). Any help would be appreciated.
ChartHoursByWeek.ChartType =
ChartType.Composite
ChartHoursByWeek.CompositeChart.ChartAreas.Clear()
ChartHoursByWeek.Series.Clear()
ChartHoursByWeek.ResetAxis()
ChartHoursByWeek.DataSource = dataHoursByWeek
Dim area As New ChartArea()
ChartHoursByWeek.CompositeChart.ChartAreas.Add(area)
'create 5 stacked series
series1.Data.DataSource = dataHoursByWeek
series1.Data.LabelColumn =
"date"
series1.Data.ValueColumn =
"regular"
series1.Label =
series1.DataBind()
ChartHoursByWeek.CompositeChart.Series.Add(series1)
series2.Data.LabelColumn =
series2.Data.DataSource = dataHoursByWeek
series2.Data.ValueColumn =
"indirect"
series2.Label =
series2.DataBind()
ChartHoursByWeek.CompositeChart.Series.Add(series2)
series3.Data.LabelColumn =
series3.Data.DataSource = dataHoursByWeek
series3.Data.ValueColumn = "vacation"
series3.Label =
"vacation"
series3.DataBind()
ChartHoursByWeek.CompositeChart.Series.Add(series3)
series4.Data.LabelColumn =
series4.Data.DataSource = dataHoursByWeek
series4.Data.ValueColumn =
"sick"
series4.Label =
series4.DataBind()
ChartHoursByWeek.CompositeChart.Series.Add(series4)
series5.Data.LabelColumn =
series5.Data.DataSource = dataHoursByWeek
series5.Data.ValueColumn =
"holiday"
series5.Label =
series5.DataBind()
ChartHoursByWeek.CompositeChart.Series.Add(series5)
'create the axes for stacked chart
xAxis.DataType =
AxisDataType.String
xAxis.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.
SetLabelAxisType.GroupBySeries
xAxis.Labels.ItemFormat =
AxisItemLabelFormat.ItemLabel
area.Axes.Add(xAxis)
Dim yAxis As New AxisItem(ChartHoursByWeek, AxisNumber.Y_Axis)
yAxis.DataType =
AxisDataType.Numeric
yAxis.Labels.ItemFormat =
AxisItemLabelFormat.DataValue
area.Axes.Add(yAxis)
'stacked layer
stackLayer.ChartType =
ChartType.StackColumnChart
stackLayer.AxisX = xAxis
stackLayer.AxisY = yAxis
stackLayer.Series.Add(series1)
stackLayer.Series.Add(series2)
stackLayer.Series.Add(series3)
stackLayer.Series.Add(series4)
stackLayer.Series.Add(series5)
stackLayer.ChartArea = area
ChartHoursByWeek.CompositeChart.ChartLayers.Add(stackLayer)
'create a line series
lineSeries.Data.DataSource = dataHoursByWeek
lineSeries.Data.LabelColumn =
lineSeries.Data.ValueColumn =
"avgAll"
lineSeries.Label =
"firm average"
lineSeries.DataBind()
lineSeries.PEs.Add(
New PaintElement(Color.Blue))
ChartHoursByWeek.CompositeChart.Series.Add(lineSeries)
'create a line layer
lineLayer.ChartType =
ChartType.LineChart
Hello Bob,
It is a little bit difficult to read the attached code, but looking at the provided information, I think that you should add two X axis (one for stack column chart and another one for the line chart). I made small sample for you. Please take a look at the attached sample for more details and let me know if you have any questions.
Regards
Have you been able to resolve your issue ? Did you have a time to take a look at the attached sample. Let me know if you have any questions.