Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Message ID: 3186     Entry time: 17 Dec 2025
Author: Derek Fujimoto 
Topic: Info 
Subject: mplot updates 

Hello everyone,

Stefan and I have make a few updates to mplot to clean up some of the code and make it more usable directly from Javascript. With one exception this does not change the html interface. The below describes changes up to commit cd9f85c

Breaking Changes:

  • The idea is to have a "graph" be the overarching figure object, whereas the "plot" is the line or points associated with a single dataset.
    • Some internal variable names have been changed to reflect this while minimizing breaking changes
    • defaultParam renamed defaultGraphParam.
    • There is no longer an initialized defaultParam.plot[0], these defaults are now defaultPlotParam which is a separate global variable
    • MPlotGraph constructor signature MPlotGraph(divElement, param) changed to MPlotGraph(divElement, graphParam)
  • HTML key data-bgcolor changed to data-zero-color as the former was misleading

New Features

  • New addPlot() function. 
    • While the functionality of setData is preserved you can now use addPlot(plotParam) to add a new plot to the graph with minimal copying of the old defaultParam.plot[0]
    • Minimal example, from plot_example.html: given some div container with id "P6":
         let d = document.getElementById("P6"); // get div 
         d.mpg = new MPlotGraph(d, { title: { text: "Generated" }}); // make graph
         d.mpg.addPlot( { xData: [0, 1, 2, 3, 4], yData: [10, 12, 12, 14, 11] } ); // add plot to the graph
    • modifyPlot() and deletePlot() still to come
  • New lines styles: none, solid, dashed, dotted
  • Barplot-style category plots
ELOG V3.1.4-2e1708b5