solidtime icon indicating copy to clipboard operation
solidtime copied to clipboard

Exported PDF "Description" colors do not match what is seen in the backend

Open smileBeda opened this issue 8 months ago • 2 comments

Description

When viewing reports in the backend we see a nice differentiated color set:

Image

(which admittedly could be better because the more "descriptions" are present, the more identical colors are used)

However in the exported PDF for the same report, it really becomes hard to distinguish the pie sections of the same: Image

Interesting is, that if I use "Tasks" as the first group this does not seem to be as bad.

This seems like a bug to me, because it makes it very hard to show a properly differentiated pie chart, and it should probably (?) follow the same coloring as we see in the backend?

Steps To Reproduce

  1. Create some time entries with task, project and description
  2. View the report in the backend
  3. Export it as PDF and view the PDF

Self-hosted or Cloud?

Self-Hosted

Version of solidtime: (for self-hosted)

main

solidtime self-hosting guide: (for self-hosted)

database+docker

smileBeda avatar Apr 29 '25 14:04 smileBeda

For all groups that do not have a defined color (like projects) the report should generate a random color. So if you create another report the colors are different for something groups like description or tasks. That your report has so many blue colors which makes it hard to distinguish could therefore be a coincidence. The color system currently only has about 20 colors. We'll discuss a better solution to this, but if you need a fast solution, just create the report multiple times until the colors look good to you.

korridor avatar Apr 30 '25 10:04 korridor

I have exported the same report 4 times today (reloaded page between each export) and I got the exact same result each time:

Image

Did I do something wrong?


I understand the difficulty at hand - having implemented such PDF generation off "timeEdition" csv reports. The challenge exactly was that python (in which I implemented this) does not "know" colors in the sense of being able to smartly generate distinguishable - and specially making sure adjacent colors - colors.

Of course one can code in logic that assures great enough distance between the RGB values, but the more pie slices you have the harder that becomes.

The way I solved it is I added tiny border around the slices in a distinguishable color never used for slices themselves (black or white). This allows for visual separation, while not having a great deal of challenge with the slice colors themselves.

But I am not sure this is possible in the library you use.

smileBeda avatar Apr 30 '25 14:04 smileBeda