Hi,
I'm currently working on a project that uses Composite Charts. I've seen a couple of examples on the forum and I tried to reproduce a Composite chart composed of a Column Chart and a Line chart. When I excute the code, I can see the Colums, the X and Y Axis of the column chart. I also obtain the X and Y2 axis for my Line chart, but I never see the line on my chart. The line never appear but the data is good and I don't really understand why it doesn't work. Can someone help me with this?Here's the code
The object chtMainGraph is my Infragistics.Win.UltraWinChart.UltraChart objectThe oCurrentGraph.GetData() returns this data
Mois CoutVoulu
janvier 12 février 15 mars 18 avril 21 mai 24 juin 27 juillet 30 août 33 septembre 36 octobre 39
The oCurrentGraph.GetSecondaryData() returns
Mois2 CoutVoulu2
janvier 16 février 20 mars 24 avril 28 mai 32 juin 36 juillet 40 août 44 septembre 48 octobre 52
I checked the data and everything is valid
------------------------------------
chtMainGraph.CompositeChart.ChartAreas.Add(area1)
xaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis
xaxis.DataType = UltraChart.Shared.Styles.AxisDataType.String
xaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel
xaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries
xaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto
xaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal
yaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y_Axis
yaxis.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric
yaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue
yaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.GroupBySeries
yaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto
yaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal
yaxis.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom
yaxis.RangeMin = 0
yaxis.RangeMax = 75
xaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis
xaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.String
xaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData
yaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y2_Axis
yaxis2.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric
yaxis2.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue
yaxis2.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData
yaxis2.RangeMin = 0
yaxis2.RangeMax = 150
chtMainGraph.ChartType = UltraChart.Shared.Styles.ChartType.Composite
Dim appearenceColumn As New UltraChart.Resources.Appearance.ChartLayerAppearance()
seriesColumn.Data.DataSource = oCurrentGraph.GetData()
seriesColumn.Data.LabelColumn = "Mois"
seriesColumn.Data.ValueColumn = "CoutVoulu"
seriesLine.Data.LabelColumn = "Mois2"
seriesLine.Data.ValueColumn = "CoutVoulu2"
appearenceColumn.ChartArea = area1
appearenceColumn.Series.Add(seriesColumn)
appearenceColumn.AxisX = xaxis
appearenceColumn.AxisY = yaxis
appearenceLine.ChartType = UltraChart.Shared.Styles.ChartType.ColumnChart
appearenceLine.ChartArea = area1
appearenceLine.Series.Add(seriesLine)
appearenceLine.AxisX = xaxis2
appearenceLine.AxisY2 = yaxis2
chtMainGraph.CompositeChart.ChartLayers.Add(appearenceLine)
area1.Axes.Add(xaxis)
area1.Axes.Add(yaxis)
area1.Axes.Add(xaxis2)
area1.Axes.Add(yaxis2)
chtMainGraph.Series.AddRange(New Infragistics.UltraChart.Data.Series.ISeries() {seriesLine, seriesColumn})
chtMainGraph.Series.DataBind()
The result I get is the image attached to this post
Thanks for your answer.
yannh,
You are setting appearanceLine.axisX and axisY2 instead of axisY. Change the one line of code to the following:
appearenceLine.AxisY = yaxis2
and you will see your second layer. The second layer will be using the Y2 axis on the right as its Y axis. On a side note, you have also set appearenceLine's ChartType to ColumnChart. If you want to see a LineChart, change the ChartType to LineChart.
Kim, I changed the lines you telled me but I get the same result. I never get the line on my graphic.
Sorry for the ColumnChart ChartType on the appearenceLine, it was a copy/paste mistake I made when I copied the code on the forum.
Here's my code with the modified lines if you want to look at it:
yaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y2_Axis
yaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y_Axis
Dim seriesLine As New UltraChart.Resources.Appearance.NumericSeries
appearenceLine.ChartType = UltraChart.Shared.Styles.ChartType.LineChart
Thanks