This is a migrated thread and some comments may be shown as answers.
RadChart Programmatically
1 Answer 52 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gonzalo
Top achievements
Rank 2
Gonzalo asked on 13 Mar 2012, 06:53 PM
Is there a way to write this in winforms. I got this example from silverlight docs.
Private Function CreateChart_DefaultView() As Telerik.Windows.Controls.RadChart
    Dim telerikChart As New Telerik.Windows.Controls.RadChart()
    'Chart Title
    telerikChart.DefaultView.ChartTitle.Content = "Year 2009"
    telerikChart.DefaultView.ChartTitle.HorizontalAlignment = HorizontalAlignment.Center
    'Chart Legend
    telerikChart.DefaultView.ChartLegend.UseAutoGeneratedItems = True
    'Line Chart
    Dim lineSeries As New DataSeries()
    lineSeries.LegendLabel = "Turnover"
    lineSeries.Definition = New LineSeriesDefinition()
    Dim dataPoint As New DataPoint()
    dataPoint.YValue = 154
    dataPoint.XCategory = "Jan"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 138
    dataPoint.XCategory = "Feb"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 143
    dataPoint.XCategory = "Mar"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 120
    dataPoint.XCategory = "Apr"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 135
    dataPoint.XCategory = "May"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 125
    dataPoint.XCategory = "Jun"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 179
    dataPoint.XCategory = "Jul"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 170
    dataPoint.XCategory = "Aug"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 198
    dataPoint.XCategory = "Sep"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 187
    dataPoint.XCategory = "Sep"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 193
    dataPoint.XCategory = "Nov"
    lineSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 176
    dataPoint.XCategory = "Dec"
    lineSeries.Add(dataPoint)
    telerikChart.DefaultView.ChartArea.DataSeries.Add(lineSeries)
    'Bar Chart
    Dim barSeries As New DataSeries()
    barSeries.LegendLabel = "Expenses"
    barSeries.Definition = New BarSeriesDefinition()
    dataPoint = New DataPoint()
    dataPoint.YValue = 45
    dataPoint.XCategory = "Jan"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 48
    dataPoint.XCategory = "Feb"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 53
    dataPoint.XCategory = "Mar"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 41
    dataPoint.XCategory = "Apr"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 32
    dataPoint.XCategory = "May"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 28
    dataPoint.XCategory = "Jun"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 63
    dataPoint.XCategory = "Jul"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 74
    dataPoint.XCategory = "Aug"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 77
    dataPoint.XCategory = "Sep"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 85
    dataPoint.XCategory = "Oct"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 89
    dataPoint.XCategory = "Nov"
    barSeries.Add(dataPoint)
    dataPoint = New DataPoint()
    dataPoint.YValue = 80
    dataPoint.XCategory = "Dec"
    barSeries.Add(dataPoint)
    telerikChart.DefaultView.ChartArea.DataSeries.Add(barSeries)
    Return telerikChart
End Function
I am well versed on using winforms chart control. I would like to do the same using RadChart. A few examples would be nice. Thank you.

G

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 16 Mar 2012, 09:46 AM
Hello Gonzalo,

As I can see from the code snippet you sent , the Chart was manually populated with data. This is absolutely possible with RadChart for Winforms. Since you are new to the control, I suggest that you review our documentation as well as online demos which I believe you will find a helpful starting guide.
You'll find this approach of manually populating the chart with data also derscribed in the resources I mentioned.

Regards,
Evgenia
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Asked by
Gonzalo
Top achievements
Rank 2
Answers by
Evgenia
Telerik team
Share this question
or