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
60
composite charts
posted

I am trying to plot a composite chart with two Y axis (numeric values) and X axis = datetime. The values are appearing on both Y axis but I dont see the line charts or anything on X axis , basically the body of the chart is blank... 

I cant figure out where I am making a mistake... 

ds.Tables[0] has three columns X datetime , Y numeric , Y2 numeric...


            UltraChart composite1 = new UltraChart();
            //composite1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite;

            composite1.ChartType = ChartType.Composite;

            composite1.DataSource = ds.Tables[0];
            ChartArea area = new ChartArea();
            composite1.CompositeChart.ChartAreas.Add(area);

            //AxisItem x = new AxisItem( composite1, AxisNumber.X_Axis);
            AxisItem x = new AxisItem();
            x.OrientationType = AxisNumber.X_Axis;
           
            x.DataType = AxisDataType.Time   ;
            x.SetLabelAxisType = SetLabelAxisType.ContinuousData;
            x.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;
            area.Axes.Add(x);

            //AxisItem y = new AxisItem(composite1, AxisNumber.Y_Axis);
            AxisItem y = new AxisItem();
            y.OrientationType = AxisNumber.Y_Axis;

            y.DataType = AxisDataType.Numeric;
            y.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
            area.Axes.Add(y);

            //AxisItem y2 = new AxisItem(composite1, AxisNumber.Y2_Axis);
            AxisItem y2 = new AxisItem();
            y2.OrientationType = AxisNumber.Y2_Axis;
            y2.DataType = AxisDataType.Numeric;
            y2.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
            area.Axes.Add(y2);

            NumericSeries s1 = new NumericSeries();
            s1.Data.DataSource = ds.Tables[0];
            s1.Data.ValueColumn = "Y";
            s1.Data.LabelColumn = "X";
            s1.DataBind();
            composite1.CompositeChart.Series.Add(s1);

            NumericSeries s2 = new NumericSeries();
            s2.Data.DataSource = ds.Tables[0];
            s2.Data.ValueColumn = "Y2";
            s2.Data.LabelColumn = "X";
            s2.DataBind();
            composite1.CompositeChart.Series.Add(s2);

            ChartLayerAppearance layer1 = new ChartLayerAppearance();
            layer1.AxisX = x;
            layer1.AxisY = y;
            layer1.ChartArea = area;
            layer1.ChartType = ChartType.LineChart;
            layer1.Series.Add(s1);
            composite1.CompositeChart.ChartLayers.Add(layer1);

            ChartLayerAppearance layer2 = new ChartLayerAppearance();
            layer2.AxisX = x;
            layer2.AxisY = y2;
            layer2.ChartArea = area;
            layer2.ChartType = ChartType.LineChart;
            layer2.Series.Add(s2);
         //   layer2.SwapRowsAndColumns = true;   
        composite1.CompositeChart.ChartLayers.Add(layer2);

            composite1.Height = 600;
            composite1.Width = 1300;

            this.WebPanel1.Controls.Add(composite1);
 

 

Parents Reply Children
No Data