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
100
Problem in composite chart with Spline and scatter chart layer.
posted

I am facing a problem while developing a composite chart with spline and scatter chart layer. Both the layers are not display with no error. Kindly reply me back if any body find a problem in the following code ;

 

SqlConnection conn = new SqlConnection("Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=ZIPCODEDB;Data Source=192.168.0.101\\sqlexpress");
            conn.Open();
          
            DataTable dtseries3rd = new DataTable();
           
            DataTable oTable = new DataTable();
            dtseries3rd.Columns.Add("col1", typeof(double));
            dtseries3rd.Columns.Add("col2", typeof(double));


            SqlCommand cmd1 = null;
            cmd1 = new SqlCommand("select * from [5th-95th-optionalchart-girlsweightforstature]", conn);
            cmd1.Connection = conn;
            SqlDataAdapter oDatapter = new SqlDataAdapter();           
            oDatapter.SelectCommand = cmd1;
            oDatapter.Fill(oTable);

            foreach (DataRow dr in oTable.Rows)
            {              
                    dtseries3rd.Rows.Add(new object[] { dr[1], dr[2] });
            }

            this.ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite;

            ChartArea myChartArea = new ChartArea();
            this.ultraChart1.CompositeChart.ChartAreas.Add(myChartArea);

            AxisItem xAxis = new AxisItem(ultraChart1, AxisNumber.X_Axis);
            xAxis.DataType = AxisDataType.String;
            xAxis.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;
            xAxis.Labels.Orientation = TextOrientation.VerticalLeftFacing;
            xAxis.Extent = 140;
            xAxis.LineColor = Color.DodgerBlue;
            xAxis.LineEndCapStyle = LineCapStyle.DiamondAnchor;
            xAxis.LineThickness = 4;
            xAxis.Labels.ItemFormatString = "<ITEM_LABEL:##.#>";
            myChartArea.Axes.Add(xAxis);

            AxisItem yAxis = new AxisItem(ultraChart1, AxisNumber.Y_Axis);
            yAxis.DataType = AxisDataType.Numeric;
            yAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
            yAxis.Extent = 40;
            yAxis.LineColor = Color.RoyalBlue;
            yAxis.LineEndCapStyle = LineCapStyle.DiamondAnchor;
            yAxis.LineThickness = 4;
            yAxis.Labels.ItemFormatString = "<DATA_VALUE:##.##>";
            myChartArea.Axes.Add(yAxis);

            NumericSeries seriesArea1 = new NumericSeries();
            seriesArea1.Data.DataSource = dtseries3rd;
            seriesArea1.Data.LabelColumn = "col1";
            seriesArea1.Data.ValueColumn = "col2";
            PaintElement pe1 = new PaintElement();
            PaintElement pe2 = new PaintElement(System.Drawing.Color.Red);
            pe1.Fill = Color.Green;
            pe1.FillOpacity = 90;
            seriesArea1.PEs.Add(pe1);

            ChartLayerAppearance stepAreaLayer = new ChartLayerAppearance();
            stepAreaLayer.AxisX = xAxis;
            stepAreaLayer.AxisY = yAxis;
            stepAreaLayer.ChartArea = myChartArea;
            stepAreaLayer.ChartType = ChartType.SplineChart;
            ultraChart1.CompositeChart.Series.Add(seriesArea1);
            stepAreaLayer.Series.Add(seriesArea1);

            ultraChart1.CompositeChart.ChartLayers.Add(stepAreaLayer);
            ChartLayerAppearance ScatterLayer = new ChartLayerAppearance();
            ScatterLayer.AxisX = xAxis;
            ScatterLayer.AxisY = yAxis;
            ScatterLayer.ChartArea = myChartArea;
            ScatterLayer.ChartType = ChartType.ScatterChart;

            NumericSeries mySeries = new NumericSeries();
            mySeries.Points.Add(new NumericDataPoint(12.3, "adsf", false));
            ScatterLayer.Series.Add(mySeries);
            ultraChart1.CompositeChart.ChartLayers.Add(ScatterLayer);

Parents
  • 2406
    posted

    HI,

    Try setting:

    xAxis.SetLabelAxisType = Infragistics.UltraChart.Core.Layers.SetLabelAxisType.ContinuousData;

    and let me know if this helps.

Reply Children