• Resolved Mark Cookson

    (@mark-cookson)


    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?

    https://www.ads-software.com/extend/plugins/wp-business-intelligence-lite/

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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.

    Thread Starter Mark Cookson

    (@mark-cookson)

    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

    Thread Starter Mark Cookson

    (@mark-cookson)

    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.

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

    Any help would be much appreciated.

    Thanks

    Mark

    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

    Thread Starter Mark Cookson

    (@mark-cookson)

    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

    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

    Thread Starter Mark Cookson

    (@mark-cookson)

    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

    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!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Chart bars overlapping’ is closed to new replies.