2 Answers, 1 is accepted
0
Joel
Top achievements
Rank 2
answered on 27 Jul 2009, 06:43 PM
Based off of the other thread about dynamic population of the chart, I resolved the issues with naming the series in the legend and and removing the item labels. One thing I am struggling with now, that worked with the other method was setting the xaxis datalabelscolumn.
Any ideas?
Any ideas?
Private Sub Chart1_NeedDataSource(ByVal sender As Object, ByVal e As EventArgs) Handles Chart1.NeedDataSource |
Dim table As DataTable |
table = GetDTNoQ() |
Dim chart As Telerik.Reporting.Processing.Chart = DirectCast(sender, Telerik.Reporting.Processing.Chart) |
Dim chartDef As Telerik.Reporting.Chart = DirectCast(chart.ItemDefinition, Telerik.Reporting.Chart) |
Dim series1 As New Telerik.Reporting.Charting.ChartSeries() |
Dim series2 As New Telerik.Reporting.Charting.ChartSeries() |
For Each rowView As DataRowView In table.DefaultView |
Dim seriesItem1 As New Telerik.Reporting.Charting.ChartSeriesItem() |
seriesItem1.Label.Visible = False |
seriesItem1.YValue = CDbl(rowView("score")) |
seriesItem1.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid |
series1.Name = "Score" |
seriesItem1.Appearance.FillStyle.FillType = Charting.Styles.FillType.Gradient |
series1.AddItem(seriesItem1) |
Dim seriesItem2 As New Telerik.Reporting.Charting.ChartSeriesItem() |
seriesItem2.Label.Visible = False |
seriesItem2.YValue = CDbl(rowView("Score 2")) |
series2.Name = "Score 2" |
seriesItem2.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid |
seriesItem2.Appearance.FillStyle.FillType = Charting.Styles.FillType.Gradient |
series2.AddItem(seriesItem2) |
Next |
chartDef.Series.Clear() |
chartDef.Series.Add(series1) |
chartDef.Series.Add(series2) |
chartDef.PlotArea.Chart.DefaultType = Charting.ChartSeriesType.Line |
chartDef.PlotArea.XAxis.AutoScale = True |
Dim mycount As Int32 = CInt(table.Rows.Count / 8) |
Chart1.PlotArea.XAxis.LabelStep = mycount |
End Sub |
0
Hello Joel,
There is no reason why this property would not be taken into account unless there is no Weekname column in your db. Have you tried setting it in NeedDataSource to the chartDef item to see if that would make a difference?
chartDef.PlotArea.XAxis.DataLabelsColumn = "Weekname"
If still having problems, we would appreciate if you send us a runnable project.
However hiding the item labels does not require you to manually create the series at runtime and your initial problem should be resolved by setting the ShowLabels property to false, so if this was the only culprit, you can revert back to the project you've send me and test it with the above property.
Regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
There is no reason why this property would not be taken into account unless there is no Weekname column in your db. Have you tried setting it in NeedDataSource to the chartDef item to see if that would make a difference?
chartDef.PlotArea.XAxis.DataLabelsColumn = "Weekname"
If still having problems, we would appreciate if you send us a runnable project.
However hiding the item labels does not require you to manually create the series at runtime and your initial problem should be resolved by setting the ShowLabels property to false, so if this was the only culprit, you can revert back to the project you've send me and test it with the above property.
Regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.