Fork me on GitHub
jsGraph

Slot optimization

Slot optimization can be used for monotoneously increasing x data. Unlike degrade, slot optimization does not average your data, hence you will not lose y information.

Slots use webworkers to precalculate your data at different zooming levels to optimize the rendering speed. It works really well with the XIsMonotoneous() which will play a role at the highest zoom levels (when slots aren't used)

Source code

var graphinstance = new Graph( domGraph, {

  close: false,

  plugins: {
    'zoom': {
      zoomMode: 'x'
    }
  },

  pluginAction: {
    'zoom': {
      shift: false,
      ctrl: false
    }
  },

  dblclick: {
    type: 'plugin',
    plugin: 'zoom',
    options: {
      mode: 'total'
    }
  },

  series: [ 'zone', 'line' ]

} );

//     graphinstance.setBottomAxisAsTime();

var s = graphinstance.newSerie( 'serie', {
    useSlots: true
  } )
  .autoAxis()
  .setData( spectrum.data[ 0 ] )
  .XIsMonotoneous()
  .setLineColor( 'green' );

var s = graphinstance.newSerie( 'serie2', {
    useSlots: true
  } )
  .autoAxis()
  .setData( spectrum2.data[ 0 ] )
  .XIsMonotoneous()
  .setLineColor( 'red' );

graphinstance.getYAxis().setDisplay( false );
graphinstance.getXAxis().toggleGrids( false );

graphinstance.redraw();
graphinstance.drawSeries();