RadPieChart color

5 posts, 1 answers
  1. License
    License avatar
    26 posts
    Member since:
    Oct 2016

    Posted 20 Oct Link to this post

    How to auto  define colors of each data property?
  2. Nikolay Iliev
    Admin
    Nikolay Iliev avatar
    93 posts

    Posted 20 Oct Link to this post

    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
  3. License
    License avatar
    26 posts
    Member since:
    Oct 2016

    Posted 20 Oct in reply to Nikolay Iliev Link to this post

    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?
  4. Answer
    Nikolay Iliev
    Admin
    Nikolay Iliev avatar
    93 posts

    Posted 21 Oct Link to this post

    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
  5. License
    License avatar
    26 posts
    Member since:
    Oct 2016

    Posted 25 Oct in reply to Nikolay Iliev Link to this post

    Thank you for your reply
Back to Top