spectrum in legend

6 posts, 0 answers
  1. Stav
    Stav avatar
    9 posts
    Member since:
    Dec 2013

    Posted 11 Jul Link to this post

    hello,

    my question is how can I create legend in a form of spectrum (with colors and numbers, same as the attached file).

    in the attached file please ignore the chart itself and data presentation, i'm only interested in the legend presentation, its color spectrum and numbers.

    can you please show me, in code (wpf+ telerik) or references how to achieve this kind of legend?

    thank you so match

  2. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 12 Jul Link to this post

    Hi Stav,

    There is no attachment. Can you please reattach and post it again? Also, note that the forum allows you to upload only images.

    Additionally, you can check the RadLegend help documentation. The RadLegend control is used to display the RadChartView legend items.

    Regards,
    Martin
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Stav
    Stav avatar
    9 posts
    Member since:
    Dec 2013

    Posted 12 Jul Link to this post

    attachment
  5. Stav
    Stav avatar
    9 posts
    Member since:
    Dec 2013

    Posted 12 Jul in reply to Martin Link to this post

    now its ok.sorry
  6. Martin
    Admin
    Martin avatar
    1099 posts

    Posted 13 Jul Link to this post

    Hello Stav,

    RadChartView and RadLegend  don't support such visualization out of the box. However, you can achieve it with custom code. Depending on the spectrum visualization that you want to achieve I can suggest you couple approaches.
    • Define a Border next to the chart and set its Background to a LinearGradientBrush. Then map the values range that you want to display to the pixels height of the Border. And calculate the gradient of the brush. This will give you smooth transitions between the colors.
    • Another approach is to use RadLegend with custom ItemTemplate. Each legend item will contain a rectangle with a color. For example the values between 5 and 10 will have a legend item with color red. The values between 10 and 15 will have another item with color orange. Values between 15 and 20, color yellow and etc. You can find this approach in the attached project.

    Regards,
    Martin
    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  7. Stav
    Stav avatar
    9 posts
    Member since:
    Dec 2013

    Posted 17 Jul in reply to Martin Link to this post

    thank you for your detailed response it was helpful
Back to Top
UI for WPF is Visual Studio 2017 Ready