Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: Pie chart values are a little bit off

  1. #1

    Default Pie chart values are a little bit off

    Hi

    I modified the JFree_ChartComponent.xaction so to generate a pie chart from my own data.

    I query an MS SQL 2005 database to get the data. The values shown in the pie chart are a little bit different from the actual values in the database.

    This is what is printed in the pie chart legend:
    1=1998, 2=1114, 2=2867, ...

    The actual values from the database are
    1997, 1112, 2864, ...

    The difference is the sequence
    1, 2, 3, ...

    Maybe my chart definition is wrong? Can someone maybe verify whether that error happens with the sample data and hypersonic as well?

    Thanks, Tobias

  2. #2
    Join Date
    Jun 2005
    Posts
    115

    Default Re:Pie chart values are a little bit off

    Hi Tobias,

    That's an interesting problem that you're having. I checked the chart engine using both a .jsp and .xaction to create pie charts against hypersonic.

    I dumped the results from the raw SQL query into excel so I could process the results. I then compared them against the results from the .jsp and .xaction using the same query. All three results were identical and matched the numbers from the raw query.

    Sooooo, I dunno. Maybe if you attach the table schema your using and the query your hitting it with we can try to duplicate it (we have MS SQL available to us).

    Let me know if I can help you in any other way.

    Bill

  3. #3
    Join Date
    Jan 2006
    Posts
    460

    Default Re:Pie chart values are a little bit off

    Can you attach your .xaction as well?

    -Mike

  4. #4

    Default Re:Pie chart values are a little bit off

    I encountered this very same problem. I modified my query to basically change the int values to a string value using the "CASE WHEN" statement. For example select CASE WHEN myvalue=1 THEN '1' END as myvaluestr. This worked for me.

  5. #5
    Join Date
    Jan 2006
    Posts
    460

    Default Re:Pie chart values are a little bit off

    Theeren,

    We're trying to reproduce this issue so we can work through it, can you possibly send us your .xaction?

    -Mike

  6. #6

    Default Re:Pie chart values are a little bit off

    Here is my .xaction file. My SQL query on the db returns:
    eventsystemseverity count
    2 277
    3 2205
    4 21811
    5 18634

    The query for the Pie Chart is definitely adding the eventsystemseverity into the count. I have ran this at different times to make sure this is what is happening and it seems it is.

    If I change my query to: select CASE WHEN eventsystemseverity=1 THEN '1' WHEN eventsystemseverity=2 THEN '2' WHEN eventsystemseverity=3 THEN '3' WHEN eventsystemseverity=4 THEN '4' WHEN eventsystemseverity=5 THEN '5' END as eventsystemseveritystr, count(*) from ticketevents where eventsystemseverity < 6 and eventsystemseverity > 0 and (now() - timereceived) < interval '30 days' group by eventsystemseverity order by eventsystemseverity,the Pie Chart will produce the correct results. Let me know if you need more information. http://forums.pentaho.org/archived_a...eChart.xaction

    Post edited by: theeren, at: 05/30/2006 14:19

    Post edited by: theeren, at: 05/30/2006 14:20

    Post edited by: theeren, at: 05/30/2006 14:20

    Post edited by: theeren, at: 05/30/2006 14:21

    Post edited by: theeren, at: 05/30/2006 14:22

  7. #7
    Join Date
    Jan 2006
    Posts
    460

    Default Re:Pie chart values are a little bit off

    With a little modification I've reproduced this, I'll dig deeper tomorrow and report back to the forums.

    Thanks for getting back to me.
    -Mike

  8. #8
    Join Date
    Jun 2005
    Posts
    115

    Default Re:Pie chart values are a little bit off

    Hi,

    Mike showed me what was happening in his repro path. The issue is that the current pie chart engine expects the series names to be the first column defined and contain text data. The second column should contain the values.

    A bug in the code (that will be fixed in an upcoming version) munges the two values if they are both numeric.

    Good news... there is a workaround. If you expect the series column to contain numberic data you can do a conversion to varchar. For Example:

    select cast(actual AS varchar(20)) as actval, count(*) from quadrant_actuals group by actual

    Whew... that was a weird one. Thanks for all the help from the community and Mike. We'll work to get this fixed in a upcoming release.

    Bill

  9. #9
    Join Date
    Jun 2005
    Posts
    115

    Default Re:Pie chart values are a little bit off

    Just a note on this problem. I've coded a fix that has been and checked it in. It should be available in the next release.

    When the next version becomes available, you should get the correct chart results from your queries now without resorting to SQL "cast" functions.

    Bill

  10. #10

    Default Re:Pie chart values are a little bit off

    Thanks! And sorry for reporting a problem and then not providing enough detail to reproduce it.

    As usual, my excuse is that I was busy with another task... :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.