mengding / jofc2

Automatically exported from code.google.com/p/jofc2
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Pie charts do not allow decimal values between inverted commas #25

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a pie chart with some slices
2. Display it with Open Flash Chart
3. No slices will appear

What is the expected output? What do you see instead?

The expected output is the chart, but instead you see an empty chart.

What version of the product are you using? On what operating system?

Last code from trunk, last OFC2 (ichor) version.

Please provide any additional information below.

This happens because OFC2 pie charts do not allow values being between 
inverted commas ("), and PieChart.Slice objects define their "value" 
attribute as objects of class Number, which in turn are translated into 
JSON as if they were Strings.

This is solved with the attached patch, which stores values in Slices as 
Double objects, not Number. Double objects are correctly recognized by the 
JSON translator and no inverted commas are put around them. This makes pie 
charts display correctly.

The patch also solves a problem with the "addValues" method, which does 
not create a Slice for the new values added.

Also, note that this problem (values being output between inverted commas) 
also happens in line charts and bar charts, although the OFC2 flash movie 
seems to display them correctly (contrary to what happens with pie 
charts). Maybe it would be advisable to change the way "value" attributes 
are handled also in other charts...

Original issue reported on code.google.com by daniel.f...@gmail.com on 11 May 2009 at 12:53

Attachments:

GoogleCodeExporter commented 9 years ago
I have applied this patch and still get the same issue.

Below is the pretty print of my chart.  Note, the value is not surrounded by 
inverted 
commas:

DEBUG - FacetPiePanel.createChart(99) | {
   "elements": [{
      "alpha": 0.5,
      "animate": [{"type": "fade"}],
      "gradient-fill": true,
      "type": "pie",
      "values": [
         {
            "highlight": "alpha",
            "label": "Data Source",
            "text": "Data Source",
            "value": 55
         },
         {
            "highlight": "alpha",
            "label": "Data Source Type",
            "text": "Data Source Type",
            "value": 55
         },
         {
            "highlight": "alpha",
            "label": "MIME Type",
            "text": "MIME Type",
            "value": 55
         },
         {
            "highlight": "alpha",
            "label": "SETG Type",
            "text": "SETG Type",
            "value": 55
         },
         {
            "highlight": "alpha",
            "label": "Mission",
            "text": "Mission",
            "value": 53
         },
         {
            "highlight": "alpha",
            "label": "System",
            "text": "System",
            "value": 53
         },
         {
            "highlight": "alpha",
            "label": "Application",
            "text": "Application",
            "value": 52
         }
      ]
   }],
   "is_decimal_separator_comma": 0,
   "is_fixed_num_decimals_forced": 0,
   "is_thousand_separator_disabled": 0,
   "num_decimals": 2,
   "title": {"text": "Facet Pie"}
}

Original comment by markjohn...@gmail.com on 14 Jul 2009 at 2:48

GoogleCodeExporter commented 9 years ago
More info:
http://forums.openflashchart.com/viewtopic.php?f=18&t=1250

Original comment by markjohn...@gmail.com on 15 Jul 2009 at 9:33

GoogleCodeExporter commented 9 years ago
I've figured this out and it isn't related to JOFC.

It was an issue with my code not correctly updating the resource holding the 
chart 
JSON.

Apologies :)

Original comment by markjohn...@gmail.com on 15 Jul 2009 at 4:03

GoogleCodeExporter commented 9 years ago
Same a Issue 24.
I don't know how can you produce a slice value of ".
Could you give an example ?

Original comment by pierreyv...@gmail.com on 6 Apr 2010 at 7:56