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
1300
Build a legend with a composite chart
posted

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:

Parents Reply Children