我正在使用 NGChart 通过 C# 中的 Google 图表 API 生成图表。
BarChart _budgetChart = new BarChart(BarsType.Stacked, BarsDirection.Vertical, new ChartSize(500, 100), new ChartData(new int[] { 60, 20, 1 }));
当我使用此代码时,我得到一个如下所示的条形图: http://chart.apis.google.com/chart?chd=s:8UB&cht=bvs&chs=500x100
我实际上没有任何 IDeo 为什么栏已满-大小值为 60。我更喜欢使用百分比数据值,因此例如值 100 绘制一个到达最顶部的条形,值 50 绘制一个具有一半高度的栏(在本例中为 50 像素,因为我的图表高 100 像素) - 我该如何做到这一点?我在 NGChart 的文档中没有找到任何内容。
GoogleChartSharp API 以同样的方式执行此操作,所以我认为可能有一个特殊的属性或类似的东西我必须设置。
编辑:我不明白..我尝试了最大值,即 61。在此图表中,前 3 个值是 10,最后一个值是 61,因此 61 是适用于正确输出的最高值。如果该值高于 61(在本例中为 62),则整个图表将按比例缩小。
示例 1(值 61):http:// Chart.apis.google.com/chart?chd=s:KKK9&cht=bvs&chs=300x100
示例 2(值 62):http://chart.apis.google.com/chart?chd=e:AKAKAKA-&cht=bvs&chs=300x100
我根本不明白 Google 如何处理这些值。
I'm using NGChart to generate charts over Googles chart API in C#.
BarChart _budgetChart = new BarChart(BarsType.Stacked, BarsDirection.Vertical, new ChartSize(500, 100), new ChartData(new int[] { 60, 20, 1 }));
when I'm using this code, I get a bar chart that looks like this: http://chart.apis.google.com/chart?chd=s:8UB&cht=bvs&chs=500x100
I actually do not have any Ideo why the bar is full-sized with a value of 60. I'd rather like to use percentage data values, so for example the value 100 draws a bar that goes to the very top, a value of 50 draws a bar that has the half height ( would be 50px in this example, as my graph is 100px high) - How do I do that? I didn't find anything in the docs of NGChart.
the GoogleChartSharp API does it the same way, so I think there is maybe a special property or sth like that I have to set.
Edit: I don't get it.. I tried the maximum value, which is 61. In this chart, the first 3 values are 10 and the last one is 61, so 61 is the highest value that works for correct output. If the value is higher than 61 (in this example 62), the whole chart gets scaled down.
Ex 1 (Value 61): http://chart.apis.google.com/chart?chd=s:KKK9&cht=bvs&chs=300x100
Ex 2 (Value 62): http://chart.apis.google.com/chart?chd=e:AKAKAKA-&cht=bvs&chs=300x100
I simply don't understand how Google processes the values.
发布评论
评论(1)
我在 NGChart 中找不到有关属性的任何信息,但可以建议此解决方法:
您可以绘制一个值为 100 的条形,但是以透明颜色进行绘制,
这应该会给您带来所需的结果,但它可以解决问题...所以要小心 =)
i can't found any info about property in NGChart, but can suggest this workaround:
you can draw a bar with value of 100, but do it in transparent color
this should give you desired result, but it workaround thogh... so be careful =)