This question is locked. New answers and comments are not allowed.
Hi, I have a dynamic column chart in code-behind. I take the values from a table in my database and the values are divided by month (each month is a row in my table and each column is a group). However, my chart is showing 12 different columns with the same value for the same group. For example: in January, I have the value 10 and in February value 20 for Group A. In the chart, it is showing 12 columns with the value 10 in January and 12 columns with the value 20 in February. (I'm sorry I couldn't post a picture). I need only one column in each month. Can anyone help me with that?
At first, I'm just getting a value from one of my table columns as a test.
Here is my code:
Dim
chartGroups
As
New
RadHtmlChart()
chartGroups.ID =
"chartGroups"
chartGroups.Width = Unit.Pixel(1200)
chartGroups.Height = Unit.Pixel(600)
chartGroups.Legend.Appearance.Position = Telerik.Web.UI.HtmlChart.ChartLegendPosition.Bottom
chartGroups.PlotArea.XAxis.Items.Add(
"Jan"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Feb"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Mar"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Apr"
)
chartGroups.PlotArea.XAxis.Items.Add(
"May"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Jun"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Jul"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Aug"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Sep"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Oct"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Nov"
)
chartGroups.PlotArea.XAxis.Items.Add(
"Dec"
)
chartGroups.PlotArea.XAxis.TitleAppearance.Text =
"Month"
chartGroups.PlotArea.YAxis.TitleAppearance.Text =
"Total"
Dim
chartDataTable
As
DataSet
chartDataTable = Program_TypeGrouping_Controller.GetOrderIntake_ByYear(ddlYear.SelectedValue, 0)
Dim
npColumnSeries
As
New
ColumnSeries
Dim
groupIntake
As
New
SeriesItem
Using reader
As
DataTableReader = chartDataTable.CreateDataReader()
While
reader.Read()
Dim
test
As
Double
If
reader.IsDBNull(3)
Then
test = 0
Else
test = reader(3)
End
If
npColumnSeries.Stacked =
False
groupIntake.Name = reader.GetName(3)
npColumnSeries.Spacing = 0
groupIntake.YValue = test
npColumnSeries.LabelsAppearance.Visible =
False
npColumnSeries.SeriesItems.Add(groupIntake.YValue)
chartGroups.PlotArea.Series.Add(npColumnSeries)
End
While
End
Using
HtmlChartHolder.Controls.Add(chartGroups)