McStasMcXtrace / McWeb

Code and documentation for e-neutrons.org platform
3 stars 3 forks source link

Integrate SVG-plotter in e-neutrons platform #225

Open willend opened 5 years ago

willend commented 5 years ago

Enable interactive svg-plots via mcplot-svg - to be used on single-view of monitor plots (i.e. not in overview or sweep settings)

climbcat commented 5 years ago

Currently, gize takes precedence over pgplot, our only png plotter option (besides matplotlib, which quickly becomes unreadable for overview plots). Our modern plotters can not output a png!

This could be alleviated if the svg plotter were to be run through nodejs (/ phantomjs) to output an svg directly from the terminal. Found some people doing it here: https://stackoverflow.com/questions/18240391/exporting-d3-js-graphs-to-static-svg-files-programmatically. We could post-process this into a png somehow...

However, first the svg plotter needs enhancements, as it is quite bare-bones atm. Also a few imports from IFL, which has improved the plotting functions somewhat.

climbcat commented 5 years ago

The mcplot-svg code has been improved somewhat. We can now hook events to click/right-click/ctrl-click on the plot area, and the plotter will generate a .html file for every file in a data folder (iterate the plot graph).

willend commented 5 years ago

Looks like the y-axis might be mirrored on the 2D plots, investigate

willend commented 5 years ago

Here are a couple of example screenshots that illustrate the above mirroring, but also that the multi-line graph titles are mixed up.

Screenshot 2019-06-27 at 14 53 34 Screenshot 2019-06-27 at 14 53 38

For the "overview" plot with multiple monitors, a way to reduce the "clutter" would be to a) make tics invisible and b) Reduce the font size to something minuscule when the graph size is less than "some value"

willend commented 5 years ago

mcweb plotter navigation:

It seems the most relevant case is from overview plot to "zoom", the same for the "sweep" case. Browser back is enough to go back

climbcat commented 5 years ago

An updated version of the svg plotter has been somewhat integrated, see the branch htmlplotter on mcweb. Some missing bits and pieces are:

climbcat commented 5 years ago

Slim-text / small mode has been implemented, see https://github.com/McStasMcXtrace/McCode/commit/b818d32d15112bb50c268adb9ad608cb1ec6cc11. This mode is automatically enabled for plots smaller than 300px width or height.

NOTE: The [arbitrary] slit-text mode switch condition is easily changed by editing the function "_is_small_mode" in plotfuncs.js, found in the tools/Python/mcplot/svg folder in mccode.

climbcat commented 4 years ago

The svg plotter has been updated to plot mccode.dat files, in addition to individual monitor files. The result is a single html page with multiple plots. McWeb simrunner has been updated to make use of this feature. In combination with various other minor changes, the integration can be seen as complete.