Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
340
stacked column chart with average line chart in composite chart
posted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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

 

 

 

 

Dim series1 As New NumericSeries()

series1.Data.DataSource = dataHoursByWeek

series1.Data.LabelColumn =

 

"date"

series1.Data.ValueColumn =

 

"regular"

series1.Label =

 

"regular"

 

series1.DataBind()

ChartHoursByWeek.CompositeChart.Series.Add(series1)

 

 

 

Dim series2 As New NumericSeries()

series2.Data.LabelColumn =

 

"date"

series2.Data.DataSource = dataHoursByWeek

series2.Data.ValueColumn =

 

"indirect"

series2.Label =

 

"indirect"

 

series2.DataBind()

ChartHoursByWeek.CompositeChart.Series.Add(series2)

 

 

 

Dim series3 As New NumericSeries()

series3.Data.LabelColumn =

 

"date"

 

series3.Data.DataSource = dataHoursByWeek

series3.Data.ValueColumn = "vacation"

 

series3.Label =

 

"vacation"

 

series3.DataBind()

ChartHoursByWeek.CompositeChart.Series.Add(series3)

 

 

 

Dim series4 As New NumericSeries()

series4.Data.LabelColumn =

 

"date"

 

series4.Data.DataSource = dataHoursByWeek

series4.Data.ValueColumn =

 

"sick"

series4.Label =

 

"sick"

 

series4.DataBind()

ChartHoursByWeek.CompositeChart.Series.Add(series4)

 

 

 

Dim series5 As New NumericSeries()

series5.Data.LabelColumn =

 

"date"

series5.Data.DataSource = dataHoursByWeek

series5.Data.ValueColumn =

 

"holiday"

series5.Label =

 

"holiday"

series5.DataBind()

ChartHoursByWeek.CompositeChart.Series.Add(series5)

 

 

 

 

'create the axes for stacked chart

 

 

 

 

Dim xAxis As New AxisItem(ChartHoursByWeek, AxisNumber.X_Axis)

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

 

 

 

 

Dim stackLayer As New ChartLayerAppearance()

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

 

 

 

 

Dim lineSeries As New NumericSeries()

lineSeries.Data.DataSource = dataHoursByWeek

lineSeries.Data.LabelColumn =

 

"date"

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

 

 

 

 

Dim lineLayer As New ChartLayerAppearance()

lineLayer.ChartType =

 

ChartType.LineChart

Parents Reply Children
No Data