Dojo StackedAreas图表不接受对象作为值 [英] Dojo StackedAreas chart doesn't accept objects as values

查看:141
本文介绍了Dojo StackedAreas图表不接受对象作为值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我所使用的每个Dojo图表都允许使用包含每个值点的一系列值和工具提示的对象数组。

Every Dojo chart that I have worked with has allowed for the use of an array of objects that contain the series of values and tooltips for each value point.

当使用StackedAreas图表类型,Dojo似乎忽略了对象内的值。例如:

When using the StackedAreas chart type, Dojo seems to ignore my values inside the objects. For example:

var values = [
    {x: 1, y: 10, tooltip: 'test1'},
    {x: 2, y: 30, tooltip: 'test2'},
    {x: 3, y: 60, tooltip: 'test3'}
];

这可以在Lines,Columns和StackedColumns图表类型中工作。图表呈现轴线,您可以看到位于字符基线的标记,就像我仅为所有值提供零。

This works in Lines, Columns and StackedColumns chart types. The chart renders the axis and you can see the markers sitting on the base line of the char as if I had only supplied zero for all values.

提前感谢。希望这是有道理的。

Thanks in advance. Hope this makes sense.

推荐答案

该文档指定此页面上的不同类型: http://dojotoolkit.org/reference-guide/dojox/charting.html 在将图表连接到数据和指定数据系列。

The doc specifies the different types on this page : http://dojotoolkit.org/reference-guide/dojox/charting.html in the paragraph "Connecting Charts to Data and Specifying a Data Series".

对于任何非堆叠线条图类型,您可以指定坐标对。您需要使用与addPlot()调用中定义的hAxis和vAxis参数相对应的键。这些默认值为x和y。

[...]

使用addSeries()添加的每个数据集的堆叠图形类型都相对于上一个集合放置。这是一个简单的例子,显示了这个概念。而不是第二个数据集是在1处的直线,所有的点都高于第一个数据集的点。

chart1.addSeries("Series 1", [1, 2, 3, 4, 5]);
chart1.addSeries("Series 2", [1, 1, 1, 1, 1], {stroke: {color: "red"}});

所以,对于在stackareas图上的工具提示,首先你必须激活你的绘图上的标记,那么你必须使用自定义的dojox / charting / action2d / Tooltip,它需要一个自定义函数来产生所需的工具提示。

So, for your tooltips on a stackedareas graph, first you have to activate the markers on your plot, then you have to use a custom dojox/charting/action2d/Tooltip, which takes a custom function to produce the desired tooltip.

我在这里举了一个例子: a href =http://jsfiddle.net/psoares/nUe3C/ =nofollow> http://jsfiddle.net/psoares/nUe3C/

I've made an example here : http://jsfiddle.net/psoares/nUe3C/

希望它有帮助...

这篇关于Dojo StackedAreas图表不接受对象作为值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆