I am trying to build a clustered column chart like the attached screenshot, but can only get one data point per x-value (country). Can someone point out what I am doing wrong? Thanks
About the image you've included, is that what you expect to see or what you have done so far?The image looks like a typical column chart. You can follow this example to get a similar chart:
DataTable table = new DataTable();table.Columns.Add("label", typeof(string));table.Columns.Add("value1", typeof(double));table.Columns.Add("value2", typeof(double));table.Columns.Add("value3", typeof(double));table.Columns.Add("value4", typeof(double));table.Columns.Add("value5", typeof(double));
table.Rows.Add(new object[] { "Series 1", 10, 20, 15, 25, 15 });table.Rows.Add(new object[] { "Series 2", 30, 20, 10, 20, 10 });table.Rows.Add(new object[] { "Series 3", 20, 20, 30, 20, 10 });UltraChart1.Data.DataSource = table;UltraChart1.Data.DataBind();
I'm not doing something right. Here is how I am buildig the datatable, which should be essentially the same as your example; and my chart html:
dt.Columns.Add("label", GetType(System.String))
dt.Columns.Add("value1", GetType(System.String))
dt.Columns.Add(
"value2", GetType(System.String))
"value3", GetType(System.String))
"value4", GetType(System.String))
"value5", GetType(System.String))
"value6", GetType(System.String))
ReDim drArray(1, 5)
ReDim drArray1(1, 5)
ReDim drArray2(1, 5)
'add series 1
For cnt = 0 To 5
drArray(0, cnt) = ds.Tables(0).Rows(cnt).Item(3)
drArray(1, cnt) = ds.Tables(0).Rows(cnt).Item(4)
Next
'add series 2
drArray1(0, cnt) = ds1.Tables(0).Rows(cnt).Item(3)
drArray1(1, cnt) = ds1.Tables(0).Rows(cnt).Item(4)
'add series 3
drArray2(0, cnt) = ds2.Tables(0).Rows(cnt).Item(3)
drArray2(1, cnt) = ds2.Tables(0).Rows(cnt).Item(4)
dt.Rows.Add(
New Object() {"US", drArray(1, 0).ToString, drArray(1, 1).ToString, drArray(1, 2).ToString, drArray(1, 3).ToString, drArray(1, 4).ToString, drArray(1, 5).ToString})
New Object() {"Mexico"
, drArray1(1, 0).ToString, drArray1(1, 1).ToString, drArray1(1, 2).ToString, drArray1(1, 3).ToString, drArray1(1, 4).ToString, drArray1(1, 5).ToString})
New Object() {"Canada"
, drArray2(1, 0).ToString, drArray2(1, 1).ToString, drArray2(1, 2).ToString, drArray2(1, 3).ToString, drArray2(1, 4).ToString, drArray2(1, 5).ToString})
iColChart.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear
iColChart.ColorModel.CustomPalette =
New Color() {Color.Blue, Color.Yellow, Color.Green, Color.Purple}
iColChart.Section508Compliant =
True
iColChart.Axis.X.Labels.SeriesLabels.FormatString = " "
iColChart.DataSource = dt
iColChart.DataBind()
="Black"
="ImagePipe.aspx"
="False"
="750px">
/>
="LightBlue">
>
="False">
="1"
=""
="Center">
="Auto">
="Horizontal"
="<DATA_VALUE:#.0#>"
="VerticalLeftFacing"
="True">
=" <ITEM_LABEL>"
="Near">
="UseCollection">
="Center"
="1">
The chart won't be able to bind to your value columns, because they are of type String. You will have to change them to be numeric (int, double, etc), or if that's not possible for some reason, you'll have to create another table that is essentially a copy of the existing table, but with numeric value columns.
Isn't copy/paste a wonderful thing...lol...Thank you, I certainly missed that. The Series' aren't grouping though. Attached is the image.
You have ColumnSpacing set to 1. If you set it to 0, you'll see the proper grouping.
chart.ColumnChart.ColumnSpacing = 0
Thanks again Max. I forget that some properties have to be set to a new instance.
You can set the Font property to a new Font instance:chart.TitleBottom.Font = new Font("Arial", 14);
Well, That would make the difference wouldn't it? :-) Thanks Max! Is there a way to increase the font-size of the chart's TitleBottom(that displays below the x-axis)? I would like for it to stand out, but I can't seem to figure out how to get it to change.