CarlicosMar / dwpe

Automatically exported from code.google.com/p/dwpe
0 stars 0 forks source link

Wrong Y labeling #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In some circumstances the labeling and division of axis Y is wrong.
See snapshot in attachment.
My guess to fix the issue is that the max value of axis Y shouldn't be the max 
value of data but the next multiple of the Y subdivisions.
Example: data set = 14, 13, 12, 4, 2, 1
Y Axis contains equally distant marks at 0, 3, 6, 9, 12, 14 but distance 14-12 
< 12-9 = 9-6 = ...
So Y axis should go up to 15 if we want equidistant marks.
Bar heights are correct according to the full scale =14 but then there is a 
mismatch between bar heights and their value on axis Y.

Original issue reported on code.google.com by phil-goo...@teuwen.org on 16 Jun 2010 at 10:33

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
i too facing the same issue, Have you got any solution?
if so, please let me know.

Thanks
Thana

Original comment by thanaper...@gmail.com on 24 Jun 2010 at 12:57

GoogleCodeExporter commented 8 years ago
Hi,

I spent a few minutes trying to understand what they did wrong.
Here is a patch attached, I think it solves the problem, but only for graph 
'bar', I didn't try to fix 'line'.

Original comment by phil-goo...@teuwen.org on 24 Jun 2010 at 7:18

Attachments:

GoogleCodeExporter commented 8 years ago
Hi,
I have tried out the patch,it still showing the bar charts not correctly,if you 
managed to solve the issue, please let me know,Thanks for your help.

Original comment by thanaper...@gmail.com on 25 Jun 2010 at 11:59

GoogleCodeExporter commented 8 years ago
Please provide your dataset example

Original comment by phil-goo...@teuwen.org on 25 Jun 2010 at 12:12

GoogleCodeExporter commented 8 years ago
Hi,
Attached the dataset example,Thanks

Original comment by thanaper...@gmail.com on 25 Jun 2010 at 12:18

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi
So what's wrong with your graph?
For me the graph seems 100% correct, see capture in attachment.

Original comment by phil-goo...@teuwen.org on 25 Jun 2010 at 12:58

Attachments:

GoogleCodeExporter commented 8 years ago
Hi, 
Thank you very much for your help, i too got the graph correctly. And your 
guess (max value of axis Y shouldn't be the max value of data but the next 
multiple of the Y subdivisions) is absolutely right then only there is no 
mismatch between bar heights and their value on axis Y. for that i will try to 
find a solution.

Thanks a lot..

Original comment by thanaper...@gmail.com on 25 Jun 2010 at 4:13

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

I tried applying Phil's patch but still couldn't quite get it working. I ended 
up tweaking it a bit more. I've attached the subversion diff and the js file 
with the fix.

Original comment by bsm...@googlemail.com on 12 Aug 2010 at 8:56

Attachments:

GoogleCodeExporter commented 8 years ago
Also a quick before and after when using the original (rev 38) and the file 
posted in comment 11

Original comment by bsm...@googlemail.com on 12 Aug 2010 at 9:06

Attachments:

GoogleCodeExporter commented 8 years ago
line: 

var liBottom = canvas.height() / (yLabels.length-1);

to:

var liBottom = Math.round(canvas.height() * 
(Math.ceil(totalYRange/(yLabels.length-1))) / totalYRange);

This error occurs when totalYRange is not a multiple of the interval.

Original comment by OsbertN...@gmail.com on 27 Oct 2010 at 9:07

GoogleCodeExporter commented 8 years ago
Good fix from bsm...@googlemail.com
I wonder why this issue hasn't been adressed before. Creating charts with small 
odd Integers as totalYRange this error is quite obvious.
My solution so far was giving up equidistant yLabels.
If you don't want to change the total yRange you can use this my fix to plot
the yLabels and lines at correct positions.

line:
.css('bottom',liBottom*i)
to:
.css('bottom',(yScale*(yLabels[i]-bottomValue)))

Original comment by photodr...@googlemail.com on 22 Nov 2010 at 1:24