Search code examples
dygraphs

Custom plotter for only specific series


I have a graph with two series. I'd like to plot one using the default plotter and one using a custom plotter. Is that possible?

I see there is the option plotter: function(e) { } which is called for each series. However, I'd like the first series to be plotted using the default plotter. Is that possible?


Solution

  • You can set the plotter on a per-series basis. For example, if your columns are X, Y1 and Y2:

    new Dygraph(div, data, {
      series: {
        // no per-series plotter for Y1
        'Y2': {
          plotter: function(e) { ... }
        }
      }
    });
    

    The "Bar & Line Chart" on the plotters demo shows a complete example of this.