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
30
I'd like to change the chart.
posted

Hi.
I am making a chart of number 1 and I want to make chart number 2.
I want the beginning of the chart to be off axis.
The line chart is displayed in the middle of the bar chart.
And I want those values to be shown on the chart.
Let me show you the code for Chart 1.
I'd appreciate it if you could tell me what to do.

Chart1

Chart2

this.uniChart1.CompositeChart.ChartLayers.Clear();
            this.uniChart1.CompositeChart.Legends.Clear();
            this.uniChart1.CompositeChart.ChartAreas.Clear();
            this.uniChart1.CompositeChart.Series.Clear();

            this.uniChart1.TitleTop.Visible = false;
            this.uniChart1.TitleLeft.Visible = false;
            this.uniChart1.TitleRight.Visible = false;
            this.uniChart1.TitleBottom.Visible = false;

            this.uniChart1.ChartType = ChartType.Composite;

            ChartArea area = new ChartArea();
            
            this.uniChart1.CompositeChart.ChartAreas.Add(area);
            

            AxisItem xAxisColumn = new AxisItem(this.uniChart1, AxisNumber.X_Axis);
            AxisItem xAxisLine = new AxisItem(this.uniChart1, AxisNumber.X_Axis);
            AxisItem yAxis = new AxisItem(this.uniChart1, AxisNumber.Y_Axis);
            AxisItem yAxisLine = new AxisItem(this.uniChart1, AxisNumber.Y2_Axis);

            xAxisColumn.DataType = AxisDataType.String;
            xAxisColumn.SetLabelAxisType = SetLabelAxisType.GroupBySeries;
            xAxisColumn.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;
           

            xAxisLine.DataType = AxisDataType.String;
            xAxisLine.SetLabelAxisType = SetLabelAxisType.ContinuousData;
            
            yAxis.DataType = AxisDataType.Numeric;
            yAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
            
            yAxisLine.DataType = AxisDataType.Numeric;
            yAxisLine.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
            
            area.Axes.Add(xAxisColumn);
            area.Axes.Add(xAxisLine);
            area.Axes.Add(yAxis);
            area.Axes.Add(yAxisLine);

            NumericSeries seriesColumn = new NumericSeries();
            seriesColumn.Label = "plan";
            seriesColumn.PEs.Add(new PaintElement(Color.LightCoral));
            seriesColumn.Data.DataSource = dt;
            seriesColumn.Data.LabelColumn = "MM";
            seriesColumn.Data.ValueColumn = "plan_amt";

            NumericSeries seriesColumn2 = new NumericSeries();
            seriesColumn2.Label = "result";
            seriesColumn2.PEs.Add(new PaintElement(Color.Aquamarine));
            seriesColumn2.Data.DataSource = dt;
            seriesColumn2.Data.LabelColumn = "MM";
            seriesColumn2.Data.ValueColumn = "result_amt";

            NumericSeries seriesLine = new NumericSeries();
            seriesLine.Label = "achieve_rate";
            seriesLine.PEs.Add(new PaintElement(Color.Blue));
            seriesLine.Data.DataSource = dt;
            seriesLine.Data.LabelColumn = "MM";
            seriesLine.Data.ValueColumn = "achieve_rate";

            this.uniChart1.Series.AddRange(new Infragistics.UltraChart.Data.Series.ISeries[] { seriesLine, seriesColumn, seriesColumn2 });

            ChartLayerAppearance columnLayer = new ChartLayerAppearance();
            columnLayer.AxisX = xAxisColumn;
            columnLayer.AxisY = yAxis;
            columnLayer.ChartArea = area;
            columnLayer.ChartType = ChartType.ColumnChart;
            columnLayer.LegendItem = LegendItemType.Point;
            columnLayer.Series.Add(seriesColumn);
            columnLayer.Series.Add(seriesColumn2);
            columnLayer.SwapRowsAndColumns = true;

            ChartLayerAppearance lineLayer = new ChartLayerAppearance();
            lineLayer.AxisX = xAxisLine;
            lineLayer.AxisY = yAxisLine;
            lineLayer.ChartArea = area;
            lineLayer.ChartType = ChartType.LineChart;
            lineLayer.LegendItem = LegendItemType.Series;
            lineLayer.Series.Add(seriesLine);

            CompositeLegend legend = new CompositeLegend();
            legend.BoundsMeasureType = MeasureType.Percentage;
            legend.ChartLayers.Add(columnLayer);
            legend.ChartLayers.Add(lineLayer);

            this.uniChart1.CompositeChart.Legends.Add(legend);
            this.uniChart1.CompositeChart.ChartLayers.Add(columnLayer);
            this.uniChart1.CompositeChart.ChartLayers.Add(lineLayer);
            this.uniChart1.ColumnChart.SeriesSpacing = 1;
            this.uniChart1.Legend.Visible = true;

 

Parents
No Data
Reply Children
No Data