Opened 14 years ago

Closed 9 years ago

#7926 closed enhancement (fixed)

Add a Historgram to dojox.charting

Reported by: ptwobrussell Owned by: ptwobrussell
Priority: low Milestone: 1.9
Component: Charting Version: 1.2.0
Keywords: Cc:
Blocked By: Blocking:


I have done some serious struggling to hack the "Columns" style chart into what is suitable for use as a histogram. The main problem is that the "Columns" style chart, AFAIK, does not allow for anything except for integers to be automatically used for column labels, so that doesn't lend itself to the bins that your histogram may need for the X-axis.

Example - suppose I want to display a histogram with a series like this, where each bin is basically some float range with an odd (maybe even non-periodic boundary):

S = {(1.3, 4), (1.7, 8), (2.5, 6), ...}

Well, that becomes a real pain to do. I'm aware that you can pass in labels for the axis, which allows you to treat each X coordinate as a consecutively increasing integer and then derive the labels and apply them. Something like this for x/y coordinate pairs:

S = [[0, 4], [1, 8], [2, 6], ...] make each X value an int

Then your labels would be something like:

L = {0 : "1.3", 1 : "1.7", 2 : "2.5", ...} now map the int to a label

In theory that kind of works - but where it gets really messy again is when you want to display only some limited subset of those X labels because the axis is too crowded otherwise - in that case you have to make sure that your interval is set to 1 so that all labels get displayed and then selectively set all the labels you don't want to see to be an empty string. But that leaves an issue with all sorts of unnecessary tick marks on the axis since the interval was set to 1.

And if you want to have uniform intervals such as the X axis labels being something like [0, 0.5, 1.0, 1.5, 2.0, ...] versus a really odd looking non-periodic scheme like [0, 1.7, 2,8, ...] (or whatever you 'trim out' of your actual series), then you have that to wade through as well.

To roll all of that up, the only point I'm trying to make is that a histogram is an extremely common chart and, although I was obviously bending the "Columns" chart in ways it probably wasn't designed to be bent in, I still found it really discouraging that I couldn't display a histogram more easily, so I wanted to document that here.

I understand that there's a Candlestick chart on the way, which might be able to render data similar to a histogram, but even if that's the case, I still think it would be a good idea to have a separate dojox.charting "Histogram" widget that simply accepts x/y coordinate pairs and displays it because users of histogram may not want to know about the additional complexities of a superset of that functionality. The working assumption would be that the x-axis values would be distributed uniformly as the "major" values with the X value itself as a label

Change History (6)

comment:1 Changed 14 years ago by Adam Peller

Component: DojoX WidgetsCharting
Owner: changed from dante to Eugene Lazutkin

comment:2 Changed 13 years ago by Eugene Lazutkin

Milestone: tbdfuture

Moving open tickets to the future.

comment:3 Changed 10 years ago by ben hockey

Priority: highlow

comment:4 Changed 10 years ago by Mathevet julien

May be ticket #15353 should fixed it.

comment:5 Changed 9 years ago by dylan

Milestone: future1.9
Owner: changed from Eugene Lazutkin to ptwobrussell
Status: newpending

Does #15353 resolve this?

comment:6 Changed 9 years ago by dylan

Resolution: fixed
Status: pendingclosed
Note: See TracTickets for help on using tickets.