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);
Hey Max, this is actually working now and yes, you are correct it was with visible=true :) Thanks for the follow up!
Can you post your code here? We can take a look at it and see if anything stands out. Typically, setting axis.MajorGridlines.Visible = true does the trick.
hi,
does your resulting graph show your gridlines? i see it in your code and tried to replicate it in mine but i am not seeing it. thanks for any help!
Ok.. that works .. thanks... I kept applying to AxisY2 and hence couldnt see anything...
You can uncomment your code for y2layer and change y2layer.AxisY2 = y2Axis to y2layer.AxisY = y2Axis.AxisY2 property is used for the layers that use both Y and Y2 axes at the same time. In most other scenarios you just want to treat the Y2 axis as the Y axis. Sorry for the confusion.