This is a migrated thread and some comments may be shown as answers.

RadChartView in RadRotator

3 Answers 71 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Javier
Top achievements
Rank 1
Javier asked on 04 Sep 2015, 05:18 PM
Dear,
I would like to know how I can add a radChartView a WinForms UI RadRotator

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 07 Sep 2015, 02:43 PM
Hello Javier,

Thank you for writing.

In order to show charts in RadRotator you can add a RadImageItem displaying the exported chart:
public Form1()
{
    InitializeComponent();
 
    for (int i = 0; i < 3; i++)
    {
        RadImageItem imageItem = new RadImageItem();
        imageItem.Image = GetChart(@"..\..\image" + i + ".png");
        this.radRotator1.Items.Add(imageItem);
    }
     radRotator1.Start(true);
}
 
private Image GetChart(string filePath)
{
    RadChartView chart = new RadChartView();
    BarSeries barSeries = new BarSeries("Performance", "RepresentativeName");
    barSeries.Name = "Q1";
    barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(128, "White"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(143, "Smith"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(111, "Jones"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(118, "Marshall"));
    chart.Series.Add(barSeries);
 
    BarSeries barSeries2 = new BarSeries("Performance", "RepresentativeName");
    barSeries2.Name = "Q2";
    barSeries2.DataPoints.Add(new CategoricalDataPoint(153, "Harley"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(141, "White"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(130, "Smith"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(88, "Jones"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(109, "Marshall"));
    chart.Series.Add(barSeries2);
 
    chart.ExportToImage(filePath,this.radRotator1.Size);
    Thread.Sleep(10);
    return new Bitmap(filePath);
}

An alternative solution is to use a RadHostItem with RadChartView
public Form1()
{
    InitializeComponent();
 
    for (int i = 0; i < 3; i++)
    {
        RadHostItem hostChart = new RadHostItem(GetChart());
        this.radRotator1.Items.Add(hostChart);
    }
     radRotator1.Start(true);
}
 
private Control GetChart()
{
    RadChartView chart = new RadChartView();
    BarSeries barSeries = new BarSeries("Performance", "RepresentativeName");
    barSeries.Name = "Q1";
    barSeries.DataPoints.Add(new CategoricalDataPoint(177, "Harley"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(128, "White"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(143, "Smith"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(111, "Jones"));
    barSeries.DataPoints.Add(new CategoricalDataPoint(118, "Marshall"));
    chart.Series.Add(barSeries);
 
    BarSeries barSeries2 = new BarSeries("Performance", "RepresentativeName");
    barSeries2.Name = "Q2";
    barSeries2.DataPoints.Add(new CategoricalDataPoint(153, "Harley"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(141, "White"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(130, "Smith"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(88, "Jones"));
    barSeries2.DataPoints.Add(new CategoricalDataPoint(109, "Marshall"));
    chart.Series.Add(barSeries2);
 
 
    return chart;
}

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Javier
Top achievements
Rank 1
answered on 09 Sep 2015, 01:20 PM
Thanks, I'll try it and you will comment on how I was.
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 10 Sep 2015, 01:05 PM
Hello Javier,

Thank you for writing back.
 
Feel free to get back to us whenever is suitable for you. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Rotator
Asked by
Javier
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Javier
Top achievements
Rank 1
Share this question
or