Hi ,
I order to Build a legend with a composite chart I use the compositelegend object.
However, the legend do not work as I want because it shows the x label instead of showing the graph's name.
This is the scenario I am using:
ChartLayerAppearance columnLayer = new ChartLayerAppearance(); columnLayer.AxisX = columnXAxis; columnLayer.AxisY = YAxis2; columnLayer.ChartArea = area; columnLayer.ChartType = ChartType.ColumnChart; columnLayer.Series.Add(VolumeNum); columnLayer.Series.Add(VolumeNumDV); columnLayer.SwapRowsAndColumns = true; ColumnChartAppearance appearance = new ColumnChartAppearance(); appearance.ColumnSpacing = 0; appearance.SeriesSpacing = 0; ChartTextAppearance ColumnTextApp = new ChartTextAppearance(); ColumnTextApp.Visible = true; ColumnTextApp.Row = 0; ColumnTextApp.Column = 1; appearance.ChartText.Add(ColumnTextApp); toplot.CompositeChart.ChartLayers.Add(columnLayer); ChartLayerAppearance lineLayer = new ChartLayerAppearance(); lineLayer.AxisX = lineXAxis; lineLayer.AxisY = YAxis; lineLayer.ChartArea = area; lineLayer.ChartType = ChartType.SplineChart; lineLayer.Series.Add(AlphaReal_st); lineLayer.Series.Add(seriesInit); lineLayer.Series.Add(VWAP_St); lineLayer.Series.Add(ClosedPrice_St); lineLayer.Series.Add(VWAP_Sector); lineLayer.Series.Add(ClosedPrice_Sector); lineLayer.Series.Add(TradedPrice_Sector); lineLayer.Series.Add(seriesInit_Sector); lineLayer.Series.Add(TableNameSer); SplineChartAppearance splineChartAppearance = new SplineChartAppearance(); LineAppearance lineAppearance = new LineAppearance(); lineAppearance.SplineTension = .3F; lineAppearance.IconAppearance.Icon = SymbolIcon.Circle; lineAppearance.IconAppearance.IconSize = SymbolIconSize.Small; lineAppearance.Thickness = 3; splineChartAppearance.LineAppearances.Add(lineAppearance); lineLayer.ChartTypeAppearance = splineChartAppearance; toplot.CompositeChart.ChartLayers.Add(lineLayer); //create LineAppearance for 1st NumericTimeSeries ChartLayerAppearance lineLayer_line = new ChartLayerAppearance(); lineLayer_line.AxisX = lineXAxis; lineLayer_line.AxisY = YAxis; lineLayer_line.ChartArea = area; lineLayer_line.ChartType = ChartType.LineChart; LineAppearance la = new LineAppearance(toplot); la.IconAppearance.Icon = SymbolIcon.None; la.Thickness = 2; LineChartAppearance lca = new LineChartAppearance(); lca.LineAppearances.Add(la); lineLayer_line.ChartTypeAppearance = lca; toplot.CompositeChart.ChartLayers.Add(lineLayer_line); toplot.BarChart.BarSpacing = 0; toplot.BarChart.SeriesSpacing = 0; //show the legend TradedPrice_Sector.Visible = false; #endregion CompositeLegend myLegend = new CompositeLegend(); myLegend.ChartLayers.Add(myColumnLayer); myLegend.Bounds = new Rectangle(0, 75, 20, 25); myLegend.BoundsMeasureType = MeasureType.Percentage; myLegend.PE.ElementType = PaintElementType.Gradient; myLegend.PE.FillGradientStyle = Infragistics.UltraChart.Shared.Styles.GradientStyle.ForwardDiagonal; myLegend.PE.Fill = Color.CornflowerBlue; myLegend.PE.FillStopColor = Color.Transparent; myLegend.Border.CornerRadius = 10; myLegend.Border.Thickness = 0; toplot.CompositeChart.Legends.Add(myLegend);
Which gives the following:
Thanks it works now.
Here is sample 2
Here is Sample 1
Hello eltorfuerte,
Could you please upload your whole sample instead of code snippet. I`m not able to reproduce your issue looking at the provided code. Meanwhile please take a look at the attached samples with composite charts and their legends and let me know if you have any questions.
Regards