LiveCharts2 icon indicating copy to clipboard operation
LiveCharts2 copied to clipboard

[Feature Request] Multi-line labels

Open rteuteu55 opened this issue 2 years ago • 3 comments

How to reproduce?

  1. Create a chart with a XAxis and a serie with some DateTime values.
  2. Add a custom Labeler with a line break 2a. Example: Labeler = value => new DateTime((long)value).ToString("dd.MM.yyyy ") + Environment.NewLine + new DateTime((long)value).ToString("HH:mm:ss"),
  3. run your test to see that the line break is replaced by a square character

Extra notes

I would expect the Labeler to allow for line break. See below how the labels get displayed: image

I am using

Live-Charts version 2.0.0-beta.101
.Net Version 5.0.301
Windows Windows 10

rteuteu55 avatar Mar 17 '22 17:03 rteuteu55

Hi @rteuteu55 and thanks for the issue!

The library draws the chart using SkiaSharp, and this feature is not supported by them, I really do not think SkiaSharp will ever support this, so this means that if we require multiline labels we should implement that.

I will keep this issue open as a reminder to implement this feature.

beto-rodriguez avatar Apr 25 '22 15:04 beto-rodriguez

Thank you for checking that. @beto-rodriguez I would love to have a go at trying to help but would have no clue where to start. Any suggestion would be welcome!

rteuteu55 avatar Apr 27 '22 08:04 rteuteu55

Here

You could split the text by each new line, then draw/measure the result.

A PR is welcome!

beto-rodriguez avatar Apr 27 '22 14:04 beto-rodriguez

Fixed with the referenced commit and will be included in the next version of the library,

Thanks for the report!

beto-rodriguez avatar Sep 02 '22 20:09 beto-rodriguez