WordPress.org

Ready to get started?Download WordPress

Forums

WP Business Intelligence Lite
[resolved] Chart bars overlapping (9 posts)

  1. Mark Cookson
    Member
    Posted 1 year ago #

    I am having a problem with bar charts in the plugin.

    I have made the following query:

    "select KO, Submission, Decision, Draw from (
    select count(finish) as KO from test_prefixtblfight where finish like "%KO%") as a,
    (select count(finish) as Submission from test_prefixtblfight where finish like "%submission%") as b,
    (select count(finish) as Decision from test_prefixtblfight where decision like "%yes%") as c,
    (select count(finish) as Draw from test_prefixtblfight where draw like "%yes%") as d"

    which returns the values:

    KO Submission Decision Draw
    301 277 423 3

    however, when I build a chart of from this query, the chart displays the bars as overlapping. ie the four bars are all on top of each other.

    Am I doing something wrong?

    http://wordpress.org/extend/plugins/wp-business-intelligence-lite/

  2. Claudio
    Member
    Plugin Author

    Posted 1 year ago #

    Hello,
    actually the logic is a bit different. You should get a result of this type:
    One column for "outcome" with values: KO, Submission, Decision, Draw
    and another column "total" with values: 301, 277, 423, 3.
    Then you should select the "outcome" column as "label" and the "total" column as "value".
    When testing the query in the query submenu you should get a 2 columns table
    I hope this helps.

  3. Mark Cookson
    Member
    Posted 1 year ago #

    Thanks Claudio

    If I understand you correctly. WP Business Intelligence reads tables horizontally ie it takes the first column in the table as the label, the second as the number. Is that correct?

    Thanks in advance

    Mark

  4. Mark Cookson
    Member
    Posted 1 year ago #

    Claudio

    Thank you for your help. The chart now displays correctly in testing. I have managed to produce four columns representing the values I wanted.

    Unfortunately, the chart doesn't display correctly on the live webpage. I get an error:
    "Uncaught SyntaxError: Unexpected token ;" at line 105 on the below page.

    http://mmadb.rodderscode.co.uk/charts/

    Any help would be much appreciated.

    Thanks

    Mark

  5. Claudio
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mark,
    concerning your first post yes and no. The columns order is not important. You decide which column contains the labels and which one contains the values. For some charts types you may need several columns with values.

    Concerning the second issue it seems that your query returns no data because in the generated JS I find:

    nvd3Data_ph_Finish = ;

    There is no data retrieved from the DB. Have you tested the query and the chart in the admin dashboard?

    regards,
    Claudio

  6. Mark Cookson
    Member
    Posted 1 year ago #

    Hi Claudio

    Thank you for your quick response.

    the query and chart seem to work fine in the admin dashboard but don't show anything on the page. The query is: (N is a null value)

    select ifnull (N, "All Fights") as Finish, count(finish) as Number from test_prefixtblfight
    union
    select ifnull (N, "KO") as Finish, count(finish) from test_prefixtblfight where finish like "%KO%"
    union
    select ifnull (N, "Submission"), count(finish) from test_prefixtblfight where finish like "%submission%"
    union
    select ifnull (N, "Decision"), count(decision) from test_prefixtblfight where decision like "%yes%"
    union
    select ifnull (N, "Draw"), count(draw) from test_prefixtblfight where draw like "%yes%"
    union
    select ifnull (N, "No Contest"), count(no_contest) from test_prefixtblfight where no_contest like "%contest%"

    which produces the correct results. From this query I built a chart and this displays correctly in the admin dashboard.

    I added

    wpbusinessintelligence id="2" type="chart" iframe="n" ] finishes [/wpbusinessintelligence]
    `

    to the page but nothing shows up on the final page.

    Do you know what the problem might be.

    Thanks again.

    Mark

  7. Claudio
    Member
    Plugin Author

    Posted 11 months ago #

    Hi Mark sorry for the late reply.
    Were you able to fix the issue? If the ID is correct, the chart should display OK unless you have some javascript issues.
    Do you have any error message in the Javascript console?
    cheers,
    Claudio

  8. Mark Cookson
    Member
    Posted 11 months ago #

    Hi Claudio

    Thanks for your response. I worked it out in the end. I thought the title in the interface was setting the ID but it wasn't. I took the ID from the URL and it worked fine.

    Thanks for you help. Great plugin!

    Mark

  9. Claudio
    Member
    Plugin Author

    Posted 11 months ago #

    Hi Mark,
    I'm glad that you were able to fix the issue and can use the plugin. Enjoy!
    kind regards,
    Claudio

    PS
    when you have time, would you mind rating the plugin on the WP plugin portal? thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic