使用谷歌图表包装器的垂直条形图的范围

发布于 2024-12-03 19:39:31 字数 1485 浏览 0 评论 0原文

我一直在尝试弄清楚如何在我的 django 中使用 google Chart-wrapper应用程序,但我似乎找不到任何有关如何使用它的文档。在玩了一段时间后,我让它完成了我想要的大部分事情,但我似乎不知道如何让范围变得非常正确。

例如,这个网址:

http://chart.apis.google.com/chart?chxt=x&chd=t:2.0,1.0,192.0,1032.0,22 .0,60.0,75.0,94.0,3.0,2.0,1.0,11.0,383.0,3.0,164.0,50.0,12.0,5.0,564.0,7671.0,115.0,331.0&a mp;chm=N%2A,000000,0,-1,11&chs=1000x300&cht=bvs&chtt=失败+类型&chxl=0:| B16|B13|B10|C11|A10|A13|D04|D03|D02|B01|C09|B05|B04|B07|C01|C03|C04|C07|A02|A01|A06|A05

有几个高于 100 的值(在 url 的 chd 部分),但是当它被渲染时,它会切断任何高于 100 的值。

这是我用来创建该 url 的代码:

hist = {}
d = Defect.objects.all()

for defect in d:
     c = Failure.objects.filter(defect = defect).count()
     if c > 0:
          hist[defect.defcode] = c

m = VerticalBarStack(hist.values())
m.title("Failure Types")
m.size(1000,300)
m.marker('N*', 'black', 0, -1, 11)
m.axes('x')
m.axes.label(0, '|'.join(hist.keys()))

谷歌图表包装器允许我编写类似于 m.range(1000) 的内容或类似的内容来指定要在图表上显示的范围,这似乎是合乎逻辑的,但是不起作用,我找不到任何真正的文档或详细、足够复杂的示例来弄清楚。

I've been trying to figure out how to use google chart-wrapper with my django application but I can't seem to find hardly any documentation on how to use it. After playing around with it for awhile I got it to do most everything I want it to, but I can't seem to figure out how to get the range quite right.

For example, this url:

http://chart.apis.google.com/chart?chxt=x&chd=t:2.0,1.0,192.0,1032.0,22.0,60.0,75.0,94.0,3.0,2.0,1.0,11.0,383.0,3.0,164.0,50.0,12.0,5.0,564.0,7671.0,115.0,331.0&chm=N%2A,000000,0,-1,11&chs=1000x300&cht=bvs&chtt=Failure+Types&chxl=0:|B16|B13|B10|C11|A10|A13|D04|D03|D02|B01|C09|B05|B04|B07|C01|C03|C04|C07|A02|A01|A06|A05

has several values above 100 (in the chd section of the url), but when it gets rendered it cuts anything above 100 off.

This is the code I used to create that url:

hist = {}
d = Defect.objects.all()

for defect in d:
     c = Failure.objects.filter(defect = defect).count()
     if c > 0:
          hist[defect.defcode] = c

m = VerticalBarStack(hist.values())
m.title("Failure Types")
m.size(1000,300)
m.marker('N*', 'black', 0, -1, 11)
m.axes('x')
m.axes.label(0, '|'.join(hist.keys()))

It seems logical that google chart-wrapper would allow me to write something along the lines of m.range(1000) or something similar to specify the range to show on the chart, but that doesn't work and I can't find any real documentation or detailed, complex enough examples to figure it out.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文