Google visualization 我可以从谷歌柱形图中获取vAxis.maxValue吗

Google visualization 我可以从谷歌柱形图中获取vAxis.maxValue吗,google-visualization,Google Visualization,我用谷歌图表画了一个柱状图。现在我想知道图表使用的实际vAxis.maxValue是什么。注意,我没有设置此值,图表已自行设置。但我想知道它使用了什么价值。我怎么能做到这一点呢?我还没有找到任何地方可以解释谷歌如何确定其最大和最小轴值(有时它们非常奇怪)。在Excel中无法计算(取决于字体大小、图表大小、线条粗细等) 处理此类问题的最简单方法是编写一个函数来确定自己的最大/最小轴值。以下代码可能会有所帮助(这是一种逻辑,可以按应用程序的需要进行调整): 我还没有找到任何地方解释谷歌如何确定其最大

我用谷歌图表画了一个柱状图。现在我想知道图表使用的实际vAxis.maxValue是什么。注意,我没有设置此值,图表已自行设置。但我想知道它使用了什么价值。我怎么能做到这一点呢?

我还没有找到任何地方可以解释谷歌如何确定其最大和最小轴值(有时它们非常奇怪)。在Excel中无法计算(取决于字体大小、图表大小、线条粗细等)

处理此类问题的最简单方法是编写一个函数来确定自己的最大/最小轴值。以下代码可能会有所帮助(这是一种逻辑,可以按应用程序的需要进行调整):


我还没有找到任何地方解释谷歌如何确定其最大和最小轴值(有时它们非常奇怪)。在Excel中无法计算(取决于字体大小、图表大小、线条粗细等)

处理此类问题的最简单方法是编写一个函数来确定自己的最大/最小轴值。以下代码可能会有所帮助(这是一种逻辑,可以按应用程序的需要进行调整):

// Take the Max/Min of all data values in all graphs (these are just arbitrary numbers)
var totalMax = 345;
var totalMin = -123;

// Figure out the largest number (positive or negative)
var biggestNumber = Math.max(Math.abs(totalMax),Math.abs(totalMin));

// Round to an exponent of 10 appropriate for the biggest number
var roundingExp = Math.floor(Math.log(biggestNumber) / Math.LN10);
var roundingDec = Math.pow(10,roundingExp);

// Round your max and min to the nearest exponent of 10
var newMax = Math.ceil(totalMax/roundingDec)*roundingDec;
var newMin = Math.floor(totalMin/roundingDec)*roundingDec;

// Determine the range of your values
var range = newMax - newMin;

// Define the number of gridlines (default 5)
var gridlines = 5;

// Determine an appropriate gap between gridlines
var interval = range / (gridlines - 1);

// Round that interval up to the exponent of 10
var newInterval = Math.ceil(interval/roundingDec)*roundingDec;

// Re-round your max and min to the new interval
var finalMax = Math.ceil(totalMax/newInterval)*newInterval;
var finalMin = Math.floor(totalMin/newInterval)*newInterval;