Thank you so much. That got me off to a great start. It is exactly what I
was trying to do. But, I still have three hang ups:
1. The metric/imperial conversion is returning a value of 0 for null items.
Is there a way to change any value 0 to null? Also, I rounded the
conversions to 2 decimals with: return Math.round(dt.getValue(row, xyz) *
123 *100)/100; The 0/null issue was happening before I made that change,
but it seemed like a good change to share (for others who might use this
code as a reference).
2. I can't seem to get the haxis to change values. I was able to get the
title to change by adding:
document.getElementById('clickMe').onclick = function () {
// change from metric to imperial and vice-versa
metric = !metric;
if (metric) {
// set up everything to draw the chart in imperial units
chart.setOption('hAxes.0.title', 'GPM');
chart.setOption('hAxes.0.maxValue', 20); ...
}
else {
// set up everything to draw the chart in metric units
chart.setOption('hAxes.0.title', 'LPM');
chart.setOption('hAxes.0.maxValue', 80); ...
This is where I believe I am going wrong.
// use calculated columns in the DataView to convert from
metric to imperial
view.setColumns([0, {
type: 'number',
label: 'GPM',
calc: function (dt, row) {
// convert GPM to LPM, round to 2 decimals
return Math.round(dt.getValue(row, 0) * 3.78541178 *100)
/100;
}
}, ...
]);
this.value = 'Switch from imperial to metric';
}
3. I cannot get the labels to change in the tooltip, and I can't seem to
include the label for the hAxes in the tooltip. Is there someway to fix
those? Or, could I create a dynamic statement at the bottom that says "At
'X value' there is 'Y1 value' and/or 'Y2 value'". ..I imagine it would be
something like the top right of Google's Annotated Time Line example
https://code.google.com/apis/ajax/playground/?type=visualization#annotated_time_line
.
Oh, and in this case there are three standard units of measure.
PSI/GPM/SCFM, MPa/LPM(liquid)/LPM(air), and Bar/m^3perHR/ Nm^3perMin. Can I
set up a single button for each, or toggle between all three? I haven't
gotten this far, but I thought I'd ask before spending a bunch of time
trying.
Thanks again. Your help probably saved me a few hours. I really appreciate
it.
On Tuesday, September 18, 2012 5:41:00 PM UTC-6, Gizamo wrote:
>
> Hello. I'm trying to make something similar to this line graph:
> http://jsfiddle.net/LuP4K/
>
> The actual chart layout I'm trying to replicate is here:
> http://wkfluidhandling.com/media/images/performance-curves/psu060-performance-curves-665x435.png
> (but I'd like to use only Standard or Metric units and allow the user to
> choose whichever they prefer with a toggle button).
>
> Anyway, it was simple enough to setup in Highcharts, but I can't seem to
> figure out how to create a GoogleCharts version of it (in part because I am
> struggling with the API features/language). Can someone please get me
> started in the correct path?
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/vrBxukuhlskJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.