Author Topic: Negative values in line chart are going positive, and axis problem  (Read 5957 times)

kenl

  • Tadpole
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
    • Email
I just created a line chart and it appears that the negative values are turning positive and also although the y axis values seem to have the right range, it also seems that the lines treat the bottom y-axis value as zero, even if it is negative number.
« Last Edit: May 25, 2011, 02:25:08 AM by kenl »

doug@dyerware.com

  • Administrator
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: +15/-0
    • View Profile
    • Email
Re: Negative values in line chart are going positive, and axis problem
« Reply #1 on: May 22, 2011, 08:40:51 PM »
wait I'm confused... I see negative values in the chart and the table data.  Are they wrong?

Could you post your shortcode here and explain what you should see in the graph?  Ill then have a real-world case to test with.

thanks
-d

kenl

  • Tadpole
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
    • Email
Re: Negative values in line chart are going positive, and axis problem
« Reply #2 on: May 23, 2011, 02:52:38 AM »
here's the code

[easychart type="line" height="1400" width="4000" title="ROI and Average Loan Age" groupnames="x,ROI, Loan Age" valuenames="07-07, 08-07, 09-07, 10-07, 11-07, 12-07, 01-08, 02-08, 03-08, 04-08, 05-08, 06-08, 07-08, 08-08, 09-08, 10-08, 11-08, 12-08, 01-09, 02-09, 03-09, 04-09, 05-09, 06-09, 07-09, 09-09, 11-09, 01-10, 03-10, 05-10, 07-10, 10-10, 01-11, 05-11" group1values="30" group2values="9.6, 14.2, -0.5, -0.8, -4.8, -5, -8.3, -7.3, -6.7, -7.1, -10.8, -1, -0.1, -0.9, 0.6, 2.8, -2.2, -1.5, -2.5, -2.4, -1.5, -1.7, -1.8, -2.1, -2.6, -3.4, -3, -2.4, -1.2, -0.7, -1.2, -0.4, 0.1, 0.6" group3values="1.5, 2.4, 3.2, 4.1, 5.1, 5.8, 6.6, 7.5, 8.1, 8.7, 7, 3.9, 3.4, 3.8, 4.1, 4.4, 4.7, 5.6, 6.5, 7.5, 8.4, 9.4, 10.4, 11.4, 12.4, 14.5, 16.5, 18.5, 20.4, 22.4, 24.4, 27.3, 30.2, 33.9"  groupcolors="FFFFFF, FF00FF, 005599" hidechartdata="false" grid="true"]

For example the blue line data (group 3) is never negative, but in the chart it starts out negative, the shape of the curve however, is correct.
The red line (group 2), goes all over the place, there seems to be no correlation between the shape of the curve and the data.

Just ignore the group one.

If I do the same chart and all the data is positive then it works fine, but when there are negative values, it screws up.

btuk

  • Tadpole
  • *
  • Posts: 2
  • Karma: +1/-0
    • View Profile
Re: Negative values in line chart are going positive, and axis problem
« Reply #3 on: May 26, 2011, 03:11:00 AM »
I mentioned a solution for using negative numbers with charts here: http://www.dyerware.com/forum/index.php/topic,56.0.html
but I thought I would repeat it for you using your example code.

In order to use negative numbers you need to add a negative "minaxis", with a setting greater than your lowest value.

In your example -10.8 is the smallest negative value, so including the following parameter will work.

minaxis="-11"


The results of your example can be see in the images below.
The top one is clearly wrong. (Note: My blog is not 4000px wide so the chart was squashed into my test page. Hence the overlapping x-axis labels)

The bottom chart uses: minaxis="-11"

Code: [Select]
[easychart type="line" minaxis="-11" height="1400" width="4000" title="ROI and Average Loan Age" groupnames="x,ROI, Loan Age" valuenames="07-07, 08-07, 09-07, 10-07, 11-07, 12-07, 01-08, 02-08, 03-08, 04-08, 05-08, 06-08, 07-08, 08-08, 09-08, 10-08, 11-08, 12-08, 01-09, 02-09, 03-09, 04-09, 05-09, 06-09, 07-09, 09-09, 11-09, 01-10, 03-10, 05-10, 07-10, 10-10, 01-11, 05-11" group1values="30" group2values="9.6, 14.2, -0.5, -0.8, -4.8, -5, -8.3, -7.3, -6.7, -7.1, -10.8, -1, -0.1, -0.9, 0.6, 2.8, -2.2, -1.5, -2.5, -2.4, -1.5, -1.7, -1.8, -2.1, -2.6, -3.4, -3, -2.4, -1.2, -0.7, -1.2, -0.4, 0.1, 0.6" group3values="1.5, 2.4, 3.2, 4.1, 5.1, 5.8, 6.6, 7.5, 8.1, 8.7, 7, 3.9, 3.4, 3.8, 4.1, 4.4, 4.7, 5.6, 6.5, 7.5, 8.4, 9.4, 10.4, 11.4, 12.4, 14.5, 16.5, 18.5, 20.4, 22.4, 24.4, 27.3, 30.2, 33.9"  groupcolors="FFFFFF, FF00FF, 005599" hidechartdata="false" grid="true"]



I hope this helps,

Simon Woodford
Betting Tips UK
« Last Edit: May 26, 2011, 03:25:21 AM by btuk »

doug@dyerware.com

  • Administrator
  • Sr. Member
  • *****
  • Posts: 456
  • Karma: +15/-0
    • View Profile
    • Email
Re: Negative values in line chart are going positive, and axis problem
« Reply #4 on: May 26, 2011, 07:27:12 AM »
thanks simon!

The problem is likely the minaxis is not computed automatically if not specified (it should pick the right # for you).  When I get the feedhopper update done Ill have some time to fix this.

-d

kenl

  • Tadpole
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
    • Email
Re: Negative values in line chart are going positive, and axis problem
« Reply #5 on: May 26, 2011, 08:57:29 PM »
Thanks!!!

 

anything