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

Customize legend styles in Doughnut series.

1 Answer 52 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lokesh
Top achievements
Rank 1
Lokesh asked on 24 May 2016, 05:10 AM
Can you please provide an example to demonstrate how to  customize legend styles and also how to make these legend items clickable ?

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 26 May 2016, 08:52 AM
Hi Lokesh,

Thanks for writing.
You can inherit from RadLegendView and override its setLegendProvider() method. Inside the method you can create a custom adapter for the underlying list view. This adapter is responsible for creating the legend items so you will have full control. The base implementation looks like this:
public void setLegendProvider(LegendInfoProvider value) {
    if (this.legendProvider == value) {
        return;
    }
    if (this.legendProvider != null) {
        this.legendProvider.getLegendInfos().removeCollectionChangeListener(this);
    }
    this.legendProvider = value;
    if (this.legendProvider != null) {
        this.legendProvider.getLegendInfos().addCollectionChangeListener(this);
        this.adapter = new LegendItemListAdapter(this.context, this.legendProvider.getLegendInfos(), this);
        this.listView.setAdapter(this.adapter);
    }
}
Feel free to modify it as you require.

Regards,
Victor
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
Chart
Asked by
Lokesh
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or