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
1225
Composite chart of all line charts?
posted

I have a chart with 5 lines, I need to be able to do NullHandling.InterpolateSimple on 2 of my lines and then NullHandling.DontPlot on 3 of them. I assume the only way to do this is with a composite chart consisting of 5 different line charts with the appropriate NullHandling method set on each? If so, how do I create these separate line charts? I have messed w/this all day and can't even get 1 to draw :(  My code I have is below...all I get is the axis but no line.   What am I missing? And once i get this one line working do i just repeat all the code for the remaining 4 lines?

//
// Dev Target
//

DataTable dt = new DataTable();

dt.Columns.Add("Date", typeof(string));
dt.Columns.Add("Value", typeof(int));

dt.Rows.Add(new object[] { "10/31/2011", 2099});
dt.Rows.Add(new object[] { "11/08/2011", null});
dt.Rows.Add(new object[] { "11/15/2011", 2400 });
dt.Rows.Add(new object[] { "11/22/2011", null });
dt.Rows.Add(new object[] { "11/30/2011", 2800 });
dt.Rows.Add(new object[] { "12/07/2011", null });
dt.Rows.Add(new object[] { "12/15/2011", 2999 });
dt.Rows.Add(new object[] { "12/22/2011", null });
dt.Rows.Add(new object[] { "12/31/2011", 3250 });

//
// First chart area
//

ultraChart1.ChartType = ChartType.Composite;

ChartArea devTargetArea = new ChartArea();
ultraChart1.CompositeChart.ChartAreas.Add(devTargetArea);

//
// Axis...
//

AxisItem xAxis = new AxisItem();
xAxis.OrientationType = AxisNumber.X_Axis;
xAxis.DataType = AxisDataType.Numeric;
xAxis.Labels.ItemFormatString = "";
xAxis.Labels.Orientation = TextOrientation.VerticalLeftFacing;
xAxis.Extent = 40;
ultraChart1.CompositeChart.ChartAreas[0].Axes.Add(xAxis);

AxisItem yAxis = new AxisItem();
yAxis.OrientationType = AxisNumber.Y_Axis;
yAxis.DataType = AxisDataType.Numeric;
yAxis.TickmarkStyle = AxisTickStyle.Smart;
yAxis.Labels.HorizontalAlign = System.Drawing.StringAlignment.Near;
yAxis.Labels.VerticalAlign = System.Drawing.StringAlignment.Near;
yAxis.Labels.Layout.Behavior = AxisLabelLayoutBehaviors.Auto;
yAxis.Labels.Visible = true;
yAxis.Labels.ItemFormat = AxisItemLabelFormat.DataValue;
yAxis.MajorGridLines.Visible = true;
ultraChart1.CompositeChart.ChartAreas[0].Axes.Add(yAxis);

//
// Create the series
//

NumericSeries devTargetSeries = new NumericSeries();
devTargetSeries.Data.DataSource = dt;
devTargetSeries.Data.LabelColumn = "Date";
devTargetSeries.Data.ValueColumn = "Value";
ultraChart1.CompositeChart.Series.Add(devTargetSeries);

ChartLayerAppearance devTargetLayer = new ChartLayerAppearance();
devTargetLayer.ChartType = ChartType.LineChart;
devTargetLayer.ChartArea = ultraChart1.CompositeChart.ChartAreas[0];
devTargetLayer.AxisX = xAxis;
devTargetLayer.AxisY = yAxis;
devTargetLayer.Series.Add(devTargetSeries);
ultraChart1.CompositeChart.ChartLayers.Add(devTargetLayer);

LineChartAppearance lcp = new LineChartAppearance();
lcp.DrawStyle = LineDrawStyle.Solid;
lcp.MidPointAnchors = false;
lcp.Thickness = 4;
lcp.NullHandling = NullHandling.InterpolateSimple;
devTargetLayer.ChartTypeAppearance = lcp;

Parents Reply Children