Figured it out.

Make sure the majorTicks option contains the min and max values.

majorTicks: ["0", "10", "20", "30", "40", "50", "60", "70", "80", "90", 
"100"],

[image: Screen Shot 2022-04-11 at 10.53.42 AM.png]

On Monday, April 11, 2022 at 10:04:19 AM UTC-6 Bob Lonseth wrote:

> I'm new to Google Charts so not sure if this is a real issue. I am 
> implementing some gauge controls in a web site and the needle is pointing 
> to incorrect values. They are close, but not close enough for me. I would 
> appreciate any suggestions to make the control point to the correct value. 
> The gauge should show 15 in the example below...
>
>
> Code: 
>
> google.charts.load('current', {'packages':['gauge']});
> google.charts.setOnLoadCallback(drawChart);
>     
> function drawChart()
> {
>       data = google.visualization.arrayToDataTable([
>         ['Label', 'Value'],
>         ["°C", 15],
>         ]);
>
>       options = {
>         width: 200, height: 200,
>         min: 0,
>         max: 100,
>         majorTicks: ["10", "20", "30", "40", "50", "60", "70", "80", "90"],
>         minorTicks: 2
>       };
>   
>       var chart = new 
> google.visualization.Gauge(document.getElementById("gauge-div"));
>       chart.draw(data, options);
> }
>
>
> Output:
>
> [image: Screen Shot 2022-04-11 at 9.59.38 AM.png]
>
> Thanks!
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/f4485555-abf7-4ce7-ad5d-cce2d46e18d8n%40googlegroups.com.

Reply via email to