OpenCDSS / cdss-app-tstool-main

Colorado's Decision Support Systems (CDSS) TSTool application main program
GNU General Public License v3.0
1 stars 1 forks source link

Improve graphics quality #268

Open smalers opened 1 year ago

smalers commented 1 year ago

Subject of the issue

Some people have commented that TSTool graphs are not at the same quality as Excel, for example. Therefore, TSTool is useful for some visualizations, but people still use Excel (for example) to create images for documents. It would be great to get feedback on what can be improved. TSTool graph performance is highly optimized for performance and interactive data viewing and some features like auto-adjusting axis labels may work differently than other software.

Here are some things that I am aware of but do not know if these are the issue. These issues seldom receive funding because funding typically goes towards functionality like commands or datastore integration. "Excel looks better" is too general to understand what needs to be improved. Specific feedback will be helpful. Some improvements might be trivial whereas others may have larger impacts that need to be tested.

  1. User Interface:
    1. Fonts: - default fonts are used for menus, buttons, etc., using the style for the operating system. It is possible to change but there are many components and coordinating would take some effort.
  2. Graphs:
    1. Fonts - currently default built-in fonts are used. It would be possible to add more fonts, but they will make time series product files uglier (longer font names) and may not be portable between computers.
    2. Font size - relatively small fonts are used by default to maximize the area available for information. The defaults were decided in previous years when display resolution was smaller. Maybe the default font size should be increased?
    3. Line pixelation - Lines on graphs are sometimes drawn in short segments rather than continuous long arrays of coordinates. This is done to improve performance but can lead to abrupt edges where a time series line bends. This can be more obvious when the line width is increased. It may also be possible to use anti-aliasing, but I tried this before with mixed results and it varied depending on what was being drawn, such as text and graphics. Is this an issue?
    4. Image format - By default images are saved as PNG because it is a lossless format, although JPEG can be used, it is a lossy format and sometimes graphs look fuzzy. It is also possible to save images as SVG (vector format), but the result may not be cleanly used in other software. Improving SVG output by updating the libraries and testing could help.
    5. 3D effects, etc. - TSTool does not implement 3D effects such as shadowing because it requires more complex software, is a performance hit, and many visualization guides discourage such things as "window dressing". For example, see the "Less is More" section of this article.
    6. Customizing graphs - the defaults, such as legends, have been chosen to work under a wide range of data conditions. Graphs can be configured by right-clicking on the graph and editing properties, and then using the ProcessTSProduct command to automate. For example, line color and symbols, legend, etc. can be configured. People may not know about all the graph properties. Perhaps annotations can be improved such as allowing text color to be set?
    7. Lack of graph or visualization - it may be that people want to use a specific graph type that TSTool does not provide. More graph types can be added based on feedback. Some enhancements that would be nice include:
      1. Allow more graph types to be combined on the same plot, such as lines, points, and plots. Some combinations are supported based on project needs but more could be done.
      2. Add a "step" graph that connects points with horizontal lines that jump at the value. This requires some care to make sure that the step is handled properly for different data intervals. This is suitable, for example, when diversions are set at a value until changed.
      3. Add a maximum gap for irregular time series so that a connecting line is not used over a specified time interval.
      4. Change the graph (e.g., line color) appearance based on the the data range.
    8. Want an all-in one data product - it may make sense to create an Excel file that includes the data and graph all in one file, rather than creating image files. It would be interesting to determine if TSTool can automate configuring Excel graphs. Images are convenient because they are general portable, can be embedded, and typically don't require special software. However, Excel has benefits.

Environment

smalers commented 1 year ago

I reviewed and experimented with fonts, with the following results:

  1. TSTool already lists all available local font families in time series product properties window so I don't think more can be done there.
  2. The default from documentation is that true type fonts will be used, which should scale well. I tried digging into the code to find a way to confirm that true type fonts are used at run time but this proved difficult to get any information.
  3. The pixelated rendering of fonts is a known issue with Java. I previously experimented and tried again. The bin/TSTool.l4j.ini file has been updated with links and -Dswing.aatext=true to turn on anti-aliasing for fonts. However, trying the -Dawt.useSystemAAFontSettings=gasp and other variations led to some fonts being bolded and other thin text being difficult to read.
  4. Internally, there is some granular control of the same font properties for drawing graphs and I may experiment more with that, but some settings would hard-code optimization for LCD and not everyone has displays that are consistent.

See:

So, no major changes at this point but maybe the minor changes will have some impact on different computers.

smalers commented 1 year ago

I did find that the JRE command line settings in the development environment did not match the deployed environment related to anti-aliasing so I made them the same. Unfortunately, this slightly impacted output images for some automated tests so I had to resave expected results. Future tweaking of graphics will also likely cause test results to change.