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

RadPieChart color

4 Answers 95 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.
License
Top achievements
Rank 1
License asked on 20 Oct 2016, 08:06 AM
How to auto  define colors of each data property?

4 Answers, 1 is accepted

Sort by
0
Nick Iliev
Telerik team
answered on 20 Oct 2016, 10:31 AM
Hello,

Can you specify what is the desired behaviour that you want to achieve?
As far as I understand you want to style the different model entries.
If that is the case you can achieve that with following the example shown in this example
The code shown in the sample app will produce the following styling for your data.


Other possible styling solutions for the chart control are also shown in the sample app.
I hope that will help you out - let us know if you need further assistance.


Regards,
Nikolay Iliev
Telerik by Progress
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
License
Top achievements
Rank 1
answered on 21 Oct 2016, 01:18 AM
Sorry I didn't make it clear.I mean pie chart in angular2,I want to define different colors for every property.Because the properties are dynamic.How can I do that?
0
Accepted
Nick Iliev
Telerik team
answered on 21 Oct 2016, 06:34 AM
Hello,

The chart itself does not support out of the box different colors for each data property - you can explicitly specify different colors for the different palette / data types. However, what can not be achieved out of the box can be achieved through angular directives when creating an Angular-2 application.
For example, you can use *ngIf directive to specify different colors based on boolean condition.
Or you can use *ngSwtich for more complex scenarios where the choices can be multiple.
Or you can even create your own custom directive with specific logic for your application.
With these different approaches, you can control the way your data is stylized.
I can recommend taking a look at this sample application that demonstrates different Angular-2 techniques in NativeScript.
Here is a specific example which shows how to apply different styles using *ngSwitch and another one showing *ngIf.
Based on that logic you can take your data chart and say
(in case myData == "firstTypeData") => apply this color for the element.


Regards,
Nikolay Iliev
Telerik by Progress
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
License
Top achievements
Rank 1
answered on 25 Oct 2016, 05:54 AM
Thank you for your reply
Tags
Chart
Asked by
License
Top achievements
Rank 1
Answers by
Nick Iliev
Telerik team
License
Top achievements
Rank 1
Share this question
or