• This is the same error as was reported 5 years ago “vertical Bar chart does not start from zero”

    If I have a data set like this:

    Year Fish Loaves
    2000 4 0
    2001 3 2
    2002 7 4

    when plotting a bar or line graph the 0 loaves for 2000 is ignored. This means the stacked result looks like this (which is plainly wrong).

    Year Fish + Loaves
    2000 (4+2) = 6
    2001 (3+4) = 7
    2002 (7+blank) = 7

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Guaven Labs

    (@elvinhaci)

    Hi.
    If you can send us sample dataset(CSV or SQL) and the screenshot of your SQL Chart page (where we can see the query, column names) we can replicate it at our end and fix it ASAP.

    Thread Starter speleo

    (@speleo)

    That’s a super fast response. Wasn’t expecting that!

    Database
    https://www.dropbox.com/s/u5rgvntki2ku83o/test_historical_membership.sql?dl=0

    The chart I’m looking to create shows the number of members of a club for each year. There are several membership types which should be stacked for each year.

    SELECT club_year, COUNT(*) AS count FROM  test_historical_membership WHERE type = 1 GROUP BY club_year ;
    SELECT club_year, COUNT(*) AS count FROM  test_historical_membership WHERE type = 2 GROUP BY club_year ;
    SELECT club_year, COUNT(*) AS count FROM  test_historical_membership WHERE type = 3 GROUP BY club_year ;
    SELECT club_year, COUNT(*) AS count FROM  test_historical_membership WHERE type = 4 GROUP BY club_year ;
    SELECT club_year, COUNT(*) AS count FROM  test_historical_membership WHERE type = 6 GROUP BY club_year ;
    SELECT club_year, COUNT(*) AS count FROM  test_historical_membership WHERE type = 7 GROUP BY club_year

    Label for X axis: Club Year
    SQL field name of X axis: club_year

    Label for Y axis: 1;2;3;4;6;7
    SQL field name of Y axis: count

    https://www.dropbox.com/s/sf93he04y2dij8g/chart_1.JPG?dl=0
    https://www.dropbox.com/s/2czrx77bn9g9dze/chart_2.JPG?dl=0
    https://www.dropbox.com/s/ri1rmcp2oe0mp38/chart_3.JPG?dl=0

    As you see from this chart all the data sets start from 0,0 rather than being linked to the Y axis. I tried the various options in

    Force start X axes at 0 Force start X axes at 0
    Show only round numbers in Y axis ticks Disable “stackedness” for datasets

    but these settings made no difference.

    You’ll also notice that I’ve not included (membership_type = 5)
    SELECT club_year, COUNT(*) AS count FROM test_historical_membership WHERE type = 5 GROUP BY club_year ;

    As this returns 0 results which stops the whole graph from showing. I can work around this so not an issue, just an info for you.

    Many many thanks for your help with this!!!

    Plugin Author Guaven Labs

    (@elvinhaci)

    i have imported your data. To understand the problem i need a bit more information.
    can you explain what the wrong is here?
    https://www.dropbox.com/s/vuw4gkszme8iguj/Screenshot%20from%202022-09-26%2017-57-39.png?dl=0

    Thread Starter speleo

    (@speleo)

    If you turn on the option “Show table-view data below the graph“, you’ll see that all the data is listed as starting from the same start date. In this case 1943.

    Data set 1 runs from 1943-today however the other data sets start later but are tied to start in 1943 as the x axis is ignored and just assumed to be sequential. Which it isn’t.

    If you run the queries one by one in phpmyAdmin you’ll see the issue.

    Many thanks!

    • This reply was modified 2 years, 2 months ago by speleo.
    Plugin Author Guaven Labs

    (@elvinhaci)

    Thank you for detailed explanation. I have fixed that key-shifting bug. Please download and install this version over the existing one.
    https://www.dropbox.com/s/4cyrz6g1tk8tesy/guaven_sqlcharts-2.3.4-rc1.zip?dl=1

    if it workes, i will push this change to the next official update.

    Thread Starter speleo

    (@speleo)

    The line graph is fixed but the issue is still there for bar graphs. Could you fix that too please?

    Plugin Author Guaven Labs

    (@elvinhaci)

    Good to hear.
    now i have applied the same to bar charts too.
    check it now pls.
    https://www.dropbox.com/s/zqr3i8y543da91u/guaven_sqlcharts-2.3.4-rc2.zip?dl=1

    Thread Starter speleo

    (@speleo)

    Perfect – fixed for bar charts too.

    Also I like the new layout of Step 3 in the backend.

    Thank you for a very quick response and fix. Most appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Does not work with multiple ranges correctly’ is closed to new replies.