Opened 9 years ago
Closed 9 years ago
#14738 closed defect (duplicate)
dojox.charting.spiderchart problem with drawing polygons
Reported by: | Martin Repta | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Charting | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Hi, it seems that spiderchart has problem with drawing polygons, in case when the data displayed in the charter have the same value for a particular axis.
Sample of code is here:
var spiderChart = new Chart2D('chartA'); var data=[ {"Sales":73,"Marketing":226,"Development":125,"Administration":135,"Support":105}, {"Sales":73,"Marketing":206,"Development":125,"Administration":235,"Support":87}, {"Sales":53,"Marketing":326,"Development":125,"Administration":145,"Support":55}];
spiderChart.addPlot("default", {
type : "Spider", labelOffset : 10, divisions : 4, seriesFillAlpha : .1, markerSize : 3, precision : 0, spiderType : "polygon", spiderColor: "silver"
}); spiderChart.addSeries("January",{ data : data[0]}, {fill : "blue"}); spiderChart.render();
The problem occurs on line 341 in dojox/charting/plot2d/Spider.js, where the value of variable distance is 0. It is caused by values in series. Max and min are the same, because it is always 125 and therefore distance is 0 and division by 0 will return NaN and rendering of shapes will fail.
I found the solution, how to skip this problem, but I do not know, what to display on this problematic axis.
As you can see on attached image, all labels on Development axis will be 125.
Can you suggest what should be min and max value on this axis?
It is quite complicated to explain this problem, but I hope, you understand where is the problem.
Attachments (1)
Change History (3)
comment:1 Changed 9 years ago by
Changed 9 years ago by
Attachment: | spider.png added |
---|
comment:2 Changed 9 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #14583.
Hi,
I think this is highly related to #14583. The root cause is exactly the same. Even if here you have 3 different series, you still have a single data point for "Development" and as the mechanism to automatically compute min/max is quite limiting it will not work.
I will close that one as a duplicated and come up with a solution in #14583 that should fix both issues.
When it comes to min/max you should have. Well it highly depends on your actual data so I can't really help here. You have to "know" what Development means and what is the usual range for this data.
After solving problem with division by 0, the Development axis has the same label for all circles and as you can see, it looks weird.