Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Trendlines in Legend
posted

Is there a way to display the chart's trendlines in the legend as well as the series themselves?

Parents
  • 30692
    Suggested Answer
    Offline posted

    Unfortunately there isn't a built in option for that. The trendline is treated as an annotation on the series rather than a series unto itself. You do have a few options available to you though (apart from a feature request). You can create a second series bound to the same data to act as the trendline, and set the stroke and brush to transparent, so that only the trendline portion shows. You could then use the title of that series to be the title of the trendline in the legend. That would leave the issue of the fact that the legend badge for that series is pulling colors that you just set to transparent. But you can fix this by providing your own LegendItemBadgeTemplate for the trendline series and bind its colors against the trendlinebrush, etc.

    Another option you have is to amend the badge for the one series to include indications of both the main colors and the trendline colors and have the title indicate both the series title and the trendline title.

    Another option you have, if you don't mind performing the trend calculation yourself is to implement the trendlines as CustomIndicator series, which has an entry in the legend.

    Or, you are of course welcome to make a feature request.

    -Graham

Reply Children