Google 图表数据编码
我最近开始研究 Google Charts API 在我正在开发的产品中的可能用途。 为给定图表构建 URL 时,可以用三种不同的格式指定数据点:未编码、使用简单编码和使用扩展编码 (http://code.google.com/apis/chart/formats.html)。 然而,似乎无法回避这样一个事实:为数据点指定的最高值正在使用扩展编码,在这种情况下为 4095(编码为“..”)。
我在这里错过了什么还是这个限制是真实的?
I have recently started looking into Google Charts API for possible use within the product I'm working on. When constructing the URL for a given chart, the data points can be specified in three different formats, unencoded, using simple encoding and using extended encoding (http://code.google.com/apis/chart/formats.html). However, there seems to be no way around the fact that the highest value possible to specify for a data point is using extended encoding and is in that case 4095 (endoded as "..").
Am I missing something here or is this limit for real?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Google Chart API 时,您通常需要自行缩放数据,使其符合 API 要求的 0-4095 范围。
例如,如果您的数据值介于 0 到 1,000,000 之间,那么您可以将所有数据除以 245,使其符合可用范围 (1000000 / 245 = 4081)。
When using the Google Chart API, you will usually need to scale your data yourself so that it fits within the 0-4095 range required by the API.
For example, if you have data values from 0 to 1,000,000 then you could divide all your data by 245 so that it fits within the available range (1000000 / 245 = 4081).
根据数据缩放,这也可能对您有所帮助:
http://code.google。 com/apis/chart/formats.html#data_scaling
请注意 chds 参数选项。
您可能还希望考虑利用包装 API 来抽象掉一些丑陋的细节。 它们列于此处:
http:// /groups.google.com/group/google-chart-api/web/useful-links-to-api-libraries
我写了charts4j 它具有帮助您处理数据缩放的功能。
Per data scaling, this may also help you:
http://code.google.com/apis/chart/formats.html#data_scaling
Note the chds parameter option.
You may also wish to consider leveraging a wrapper API that abstracts away some of these ugly details. They are listed here:
http://groups.google.com/group/google-chart-api/web/useful-links-to-api-libraries
I wrote charts4j which has functionality to help you deal with data scaling.