Google Chart - Timelines: Axis Scaling

I am trying to create a chart using Google Timeline that shows activity for the last 7 days and I am having problems scaling the x-axis.

The chart always tries to auto-scale the data, which destroys the consistency I would like to enable. I want the right side of the graph to be today and the left side seven days before today.

I can't find anything to fix the x-axis in the documentation for Timelines, or even Visualization in general, but I must assume that the chart library has the ability to customize its own axes. Does anyone have a solution that works?

A possible workaround that I am creating is to create two data points - one for today and one for today - 7 - and add them to the graph. This fixes the scaling issue, but now my graph has two arbitrary data points. (I know this is technically a separate question, but if anyone knows how to hide these two data points while keeping the scale on a fixed axis, that would be a win!)

This is what my graph looks like using only the raw data (note the axis - I would like it to be the last 7 days): axis auto-scaled

And this is what it looks like with my two "fake" data points: axis fixed-scaled, but two bad data points

EDIT: I tried using the viewWindow.max and viewWindow.min properties, but it doesn't seem to work.

+3


source to share


1 answer


I think you can cross out two dummy dots using options like:



  var options = {
    colors: ['#ffffff', '#ffffff', '#c69c6e'],
  };

      

0


source







All Articles