chartjs-plugin-trendline icon indicating copy to clipboard operation
chartjs-plugin-trendline copied to clipboard

Feature request : having the slope in percentage

Open kent2004 opened this issue 1 year ago • 1 comments

it would be nice to have the slope in percentage and maybe 2 color depending if negative or positive stops.

I guess by changing :

    const trendText = displayValue
        ? `${text} (Slope: ${slope.toFixed(2)})`
        : text;

To :

  const trendText = displayValue
      ? `${text} (Slope: ${(percentage ? (slope * 100).toFixed(2) + '%' : slope.toFixed(2))})`
      : text;

Or be able to use a function to return the slops.

Thanks

kent2004 avatar Oct 14 '24 16:10 kent2004

@kent2004 I made some changes and came up with this suggestion. Is this what you expected?

image

Makanz avatar Oct 24 '24 19:10 Makanz

@Makanz Yes in deed it is what I expected, thank you ;-)

kent2004 avatar Nov 06 '24 09:11 kent2004