Trying to set 2nd Y-axis as percentage to specific value

22 views
Skip to first unread message

dead...@gmail.com

unread,
Jun 1, 2016, 5:41:32 PM6/1/16
to Google Visualization API
Hi. I've made the following graph(hopefully this shows up):

I want to make my right Y-Axes display be a percentage of a specific value (the green line). Currently it assumed I want 1 = 100%, but in this case I want 2.8 to be 100%.

All the data is currently in the right 'absolute' scale.

Here are my options:

        var options = {
            interpolateNulls: true,
          hAxis: {
            title: 'time_logged',
          },
          vAxes: {
            0: {
              title: 'absolute',
              minValue: 0,
              maxvalue: 4,
            },
            1: {
              title: 'relative',
              minValue: 0,
              maxvalue: 4,
              format:"#%",
            },
          },
          vAxis: {
            viewWindow: {
              max: 4,
            },
          },
          series: {
              0: {
                targetAxisIndex:1
              },
              1: {
                targetAxisIndex:1
              },
          },
        };
        

dead...@gmail.com

unread,
Jun 6, 2016, 3:20:09 PM6/6/16
to Google Visualization API
Is this not possible in Google Charts?

Daniel LaLiberte

unread,
Jun 6, 2016, 3:31:03 PM6/6/16
to Google Visualization API
Hi deadballo,

There is actually an undocumented option that might help, at least for scaling the auto computed tick values.  

vAxes: { 1: { 
    "formatOptions": {
        "scaleFactor": 2.8
      }
}}

You might need 1/2.8 instead. I'm also not sure of how it will combine with the '%' format.  

Another option is to specify the tick values and formatted representations yourself.  

vAxes: { 1: {
  ticks: [ { v: 2.8, f: '100%'}, ... ]
 }}

The tooltip values for your data won't be updated in the same way, however, so you would need to specify the formatted representation of each value in your DataTable.

Hope that helps.


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/e5e13b49-877b-496e-b5ef-a04ce6026c96%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages