After doing a few grouped column charts, I'm having difficulty getting my latest one to group. I'm thinking it may be in how I'm building my datatable, but can't seem to quite get it. Any help will be greatly appreciated.
Below is my html & code, then what the chart looks like and then what the chart "should" look like. Please help. Thanks so much!
<igchart:UltraChart ID="igChart2" runat="server" BackgroundImageFileName="" BorderColor="Black" BorderWidth="0px" EmptyChartText="Data Not Available" Height="350px" Section508Compliant="True" Version="8.1" Width="750px"> <ColumnChart> <ChartText> <igchartprop:ChartTextAppearance ChartTextFont="Arial, 7pt" Column="-2" Row="-2" VerticalAlign="Far" Visible="True"> </igchartprop:ChartTextAppearance> </ChartText> </ColumnChart> <Axis> <X Extent="30" LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="True"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" ItemFormatString="<ITEM_LABEL>" Orientation="VerticalLeftFacing" VerticalAlign="Center" Visible="False"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Center" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </X> <Y LineThickness="1" TickmarkInterval="50" TickmarkStyle="Smart" Visible="True"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Far" ItemFormatString="<DATA_VALUE:00.##>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Center" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y> <Y2 LineThickness="1" TickmarkInterval="50" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="<DATA_VALUE:00.##>" Orientation="Horizontal" VerticalAlign="Center" Visible="False"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Center" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y2> <X2 LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Far" ItemFormatString="<ITEM_LABEL>" Orientation="VerticalLeftFacing" VerticalAlign="Center" Visible="False"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Center" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </X2> <Z LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" ItemFormatString="" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Center" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Z> <Z2 LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="" Orientation="Horizontal" VerticalAlign="Center" Visible="False"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Center" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Z2> <PE ElementType="None" Fill="Cornsilk" /> </Axis> <DeploymentScenario ImageType="Jpeg" /> <Data ZeroAligned="True"> </Data> <TitleTop ClipText="False" HorizontalAlign="Center" WrapText="True"> </TitleTop> <ColorModel AlphaLevel="200" ColorBegin="Pink" ColorEnd="DarkRed" ModelStyle="CustomLinear"> </ColorModel> <Border Thickness="0" /> <Effects> <Effects> <igchartprop:GradientEffect> </igchartprop:GradientEffect> </Effects> </Effects></igchart:UltraChart>
Public Sub LoadColumnChart(ByRef iPanel As Infragistics.WebUI.Misc.WebPanel, ByRef iColChart As Infragistics.WebUI.UltraWebChart.UltraChart, ByRef userProfile As Array, ByVal choice As String, Optional ByVal ChartCounter As Int16 = 1) iPanel.Visible = True iColChart.Visible = True 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.TitleTop.Text = choice iColChart.Axis.X.RangeMax = 1.0 iColChart.Axis.X.RangeMin = 0.0 iColChart.Axis.X.TickmarkInterval = 0.2 iColChart.Axis.X.RangeType = Styles.AxisRangeType.Custom iColChart.DataSource = GetColumnChartSeries(userProfile, choice) 'dt iColChart.Legend.Visible = True iColChart.Legend.Location = Styles.LegendLocation.Bottom iColChart.Axis.X.Labels.SeriesLabels.FormatString = " " iColChart.Data.SwapRowsAndColumns = False iColChart.DataBind() 'process/no measure iColChart.SaveTo(Server.MapPath(ChartImagePrimaryPath) & userProfile(7).Trim.ToLower & "_" & userProfile(47).Trim.ToLower & _ "_" & userProfile(17) & "_" & FormatQuarter(userProfile(18)) & "_" & ChartCounter & ChartImageFileExt, GetChartImageType())
End Sub
Public Function GetColumnChartSeries(ByRef userProfile As Array, ByVal choice As String) As DataTable Dim ds As New DataSet Dim dt As New DataTable Dim lower As Int64 = 2 '3 (number of series to display) Dim upper As Int64 = 2 Dim drArray As String(,) = Nothing Dim cnt As Int16 = 0 Dim cnt1 As Int16 = 0
Try ds = GetChartDataSet(userProfile, "chartperiods") If Not IsDatasetValid(ds) Then ds = GetNewChartDataSet() End If ReDim drArray(lower, upper) drArray(0, 0) = "DOGS" drArray(1, 0) = "CATS" drArray(2, 0) = "Other" cnt = 1 cnt1 = 0 For cnt1 = 0 To ds.Tables(0).Rows.Count - 1 If ds.Tables(0).Rows(cnt1).Item(3).ToString.Trim.ToLower = "dogs" Then drArray(0, cnt) = ds.Tables(0).Rows(cnt1).Item(4) cnt += 1 End If Next cnt = 1 cnt1 = 0 For cnt1 = 0 To ds.Tables(0).Rows.Count - 1 If ds.Tables(0).Rows(cnt1).Item(3).ToString.Trim.ToLower = "cats" Then drArray(1, cnt) = ds.Tables(0).Rows(cnt1).Item(4) cnt += 1 End If Next cnt = 1 cnt1 = 0 For cnt1 = 0 To ds.Tables(0).Rows.Count - 1 If ds.Tables(0).Rows(cnt1).Item(3).ToString.Trim.ToLower = "other" Then drArray(2, cnt) = ds.Tables(0).Rows(cnt1).Item(4) cnt += 1 End If Next cnt = 0 dt.Columns.Add("DOGS", GetType(System.Int64)) dt.Columns.Add("CATS", GetType(System.Int64)) dt.Columns.Add("Other", GetType(System.Int64)) dt.Rows.Add(New Object() {drArray(0, 1).ToString, drArray(1, 1).ToString, drArray(2, 1).ToString}) dt.Rows.Add(New Object() {drArray(0, 2).ToString, drArray(1, 2).ToString, drArray(2, 2).ToString})
ds = Nothing
Catch ex As Exception End Try
Return dt End Function
the reason you can only see the first datapoint is because you are setting Axis.X.RangeMin = 0, RangeMax = 1. Try setting Axis.X.RangeType back to Auto, I think that will fix the problem.
That helped, but for some reason my columns are gone and the first column value is against the y-axis.
in what way did it help? it still looks like your x-axis has no range.
i'm not sure why that would still be after setting RangeType to Auto, so i'll just attach the sample project i put together using your code. does the attached project work for you?
Thanks David, it worked just fine. After comparing the code line-by-line, I'm sheepishly ashamed to admit that I had the RangeType in two locations and for some reason, saw the second one as y-axis, not x-axis, so I was over-writing the automatic. (see my mistake below).
iColChart.Axis.X.RangeType = Styles.AxisRangeType.AutomaticiColChart.Axis.X.TickmarkInterval = 0.2iColChart.Axis.X.RangeType = Styles.AxisRangeType.Custom
Thanks for the help and sorry about the oversight!!!!!!