Fair warning : I am a novice when it comes to charting.
I am using the following data table below in a line chart currently with the exception of "Metric 4" and it works just great. What I need to do now is include "Metric 4" as a column chart behind the current line chart.
I have messed around with this data table in a ColumnLineChart (which appears to be what I need to use) but I can't get it to work. Basically I need row 4 of the DataTable to be used as the datasource of the column chart. Do I need to just make a separate data table both the column and the line chart?
-----------------------------
DataTable dt = new DataTable();
var columnDateString = new DataColumn("DateValue", typeof(string)); dt.Columns.Add(columnDateString);
dt.Columns.Add("11/1", typeof(int)); dt.Columns.Add("11/8", typeof(int)); dt.Columns.Add("11/15", typeof(int)); dt.Columns.Add("11/22", typeof(int)); dt.Columns.Add("11/29", typeof(int));
dt.Rows.Add(new object[] { "% Metric 1", 0, 10 ,25,50, 80}); dt.Rows.Add(new object[] { "% Metric 2", 0, 8, 20, 45, 70 }); dt.Rows.Add(new object[] { "% Metric 3", 0, 2, 5, 8 , 8 }); dt.Rows.Add(new object[] { "Metric 4", 0, 20, 25, 25, 25 });
Never mind, I figured it out.
Argh..actually only partially
Using the data below gets me the look I want but I have 3 questions
1) How can I use the line data as the legend?
2) I need the scale and the range of the column chart data to be based on dtColChart data, right now it is stuck at 100 even though one of the data points in there is 255.
3) How can I adjust the thickness of the column data plots?
--
dt.Columns.Add("11/1", typeof(double)); dt.Columns.Add("11/8", typeof(double)); dt.Columns.Add("11/15", typeof(double)); dt.Columns.Add("11/22", typeof(double)); dt.Columns.Add("11/29", typeof(double));
dt.Rows.Add(new object[] { "% Coverage", 0, 10 ,25,50, 80}); dt.Rows.Add(new object[] { "% Pass To Plan", 0, 8, 20, 45, 70 }); dt.Rows.Add(new object[] { "% Gated", 0, 2, 5, 8 , 8 });
DataTable dtColChart = new DataTable(); var colDate = new DataColumn("DateValue", typeof(string)); dtColChart.Columns.Add(colDate);
dtColChart.Columns.Add("11/1", typeof(double)); dtColChart.Columns.Add("11/8", typeof(double)); dtColChart.Columns.Add("11/15", typeof(double)); dtColChart.Columns.Add("11/22", typeof(double)); dtColChart.Columns.Add("11/29", typeof(double));
dtColChart.Rows.Add(new object[] { "Metric 4", 0, 20, 56, 95, 255 });
this.ultraChart1.ColumnLineChart.ColumnData.DataSource = dtColChart; this.ultraChart1.ColumnLineChart.ColumnData.DataBind(); this.ultraChart1.ColumnLineChart.LineData.DataSource = dt; this.ultraChart1.ColumnLineChart.LineData.DataBind();