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

ScatterBubbleSeries and ChartSeriesProvider

3 Answers 89 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Stefano
Top achievements
Rank 1
Stefano asked on 04 Nov 2019, 08:19 AM
I am trying to use multiple series with ChartSeriesProvider in a bubble chart ScatterBubbleSeries. The examples I found show only one series binding. The code I wrote does not work but I am not sure ScatterBubbleSeries supports this mode at all... Is there any example of ScatterBubbleSeries binding multiple series with ChartSeriesProvider?

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 05 Nov 2019, 07:12 AM

Hello Stefano,

RadChartView provides a couple of specific series descriptor implementations that support most scatter and categorical series. However, not all series are covered with them. This includes the ScatterBubbleSeries. You can see a table showing the relation between the series and the descriptors, in the Dynamic Number of Series article.

In this situation, you can use the base ChartSeriesDescriptor that allows you to use any type of series. To make it work, you can simply define the Style of the series that should be created, and in the Style set its value binding properties.

<telerik:ChartSeriesDescriptor ItemsSourcePath="MyDataPointsCollection"> 
    <telerik:ChartSeriesDescriptor.Style> 
        <Style TargetType="telerik:ScatterBubbleSeries"> 
            <Setter Property="XValueBinding" Value="XValue"/> 
            <Setter Property="YValueBinding" Value="YValue"/> 
            <Setter Property="BubbleSizeBinding" Value="BubbleSize"/>                                     
        </Style> 
    </telerik:ChartSeriesDescriptor.Style> 
</telerik:ChartSeriesDescriptor> 

Alternatively, you can implement a custom descriptor and override its CreateInstanceCore method.

public class ScatterBubbleSeriesDescriptor : ChartSeriesDescriptor
{
    public string XValueBinding { get; set; }
    public string YValueBinding { get; set; }
    public string BubbleSizeBinding { get; set; }
 
    protected override ChartSeries CreateInstanceCore(object context)
    {
        var series = new ScatterBubbleSeries();
        series.XValueBinding = new PropertyNameDataPointBinding(this.XValueBinding);
        series.YValueBinding = new PropertyNameDataPointBinding(this.YValueBinding);
        series.BubbleSizeBinding = new PropertyNameDataPointBinding(this.BubbleSizeBinding);
        return series;
    }
}

Can you please try this and let me know how it goes?

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Stefano
Top achievements
Rank 1
answered on 05 Nov 2019, 10:52 PM
Great, it works! Here is a sample (rename as zip). Thank you for your help.
0
Martin Ivanov
Telerik team
answered on 06 Nov 2019, 08:18 AM

Hello Stefano,

It is nice to hear that the suggestion works.

Regards,
Martin Ivanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
Stefano
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Stefano
Top achievements
Rank 1
Share this question
or