Logic Machine Forum
Trend scale on graphs - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Trend scale on graphs (/showthread.php?tid=2221)



Trend scale on graphs - tassiebean - 04.09.2019

Is it possible to set the max and minimum values on the trend graph? It auto-scales but I would like to set the major and minor intervals (in this case I set 'Always show zero on Y axis). Specifically, for temperature (see example screen shot attachment), I would like to have the major increments set at 5 degrees (not 4.2 degrees as shown here). I am using the 5500SHAC (as you might have guessed).

Wonderful forum, by the way, and great admin and senior member help!!

Thanks!


RE: Trend scale on graphs - admin - 05.09.2019

Try this Custom JS. Change trend ID and max value as needed. You can add if statements to set maximum value for other trends. This will only work in single trend view.

Code:
$(function(){
  if (typeof Chart != 'object') {
    return;
  }
  
  function getid() {
    var sel = $('.nav .active .a');
    if (sel.length == 1) {
      return sel.data('trend').id;
    }
  }
  
  var calcBounds = Chart.calcBounds;
  
  Chart.calcBounds = function() {
    calcBounds.apply(this);
    
    if (getid() == 1) {
      this.max = 1000;
    }
  }
});



RE: Trend scale on graphs - tassiebean - 05.09.2019

Perfect!

I took a good guess to set the minimum, and now I have the graph how I want it, with an easy to read 2 degrees per graph minor line:

Code:
    if (getid() == 1) {
      this.max = 40;
      this.min = -10;
    }
     
    if (getid() == 2) {
      this.max = 40;
      this.min = -10;
    }

Thanks very much!!

I do have another question. If I hadn't asked you, how would I find this out?

I've noted in my device there is the dygraph.js file that has 3468 lines of JS code. Do I just browse the various .js files hoping to find clues?

In looking there, it seems I might be able to choose log scales, and other goodies. Perhaps the ability to turn off the shading under the graph (fillGraph)? Set gridLineColor: "rgb(128,128,128)", and so on.

Is there a reference guide on all this? Sorry, just hoping to catch up.

Thanks again.


RE: Trend scale on graphs - admin - 05.09.2019

dygraph is not used here. Trends use modified version of Flotr2. Log scale is not supported. Grid minor/major color can be set via Custom CSS by modifying background-color property of .flotr-grid-color and .flotr-grid-minor-color classes. Fill can be hidden like this but for all trends altogether:
Code:
Flotr.graphTypes.lines.options.fillOpacity = 0;



RE: Trend scale on graphs - cekca - 06.09.2019

if i have a multiple trend with 2 different scale ( right and left ) how i can set the right scale?
thanks!


RE: Trend scale on graphs - admin - 06.09.2019

You can set this.min2 and this.max2