giorgio.galassi@unimi.it

negative value on select scatter

Recommended Posts

Hi ,

i'am a newbie of Fusion Chart . I think it is a good product. I use powercharts with jquery

 

 var myChart = new FusionCharts("resources/grafici/powercharts/Charts/SelectScatter.swf", "SelectChart", "550", "400", "1");
 myChart.setXMLData(datixml );
 myChart.render("chartdiv");

 

I create a dinamic dataset and all is good if I use positive value in dataset while I obtain

ERROR: Invalid number -115644
 specified in XML. FusionCharts can accept number in pure numerical form only. If your number formatting (thousand and decimal separator) is different, please specify so in XML. Also, do not add any currency symbols or other signs to the numbers.

 

with negative number. How could I use negative number (in data set )on select scatter chart ?

Below the case with positive value in dataset on which I have no problem :

<chart palette="3" caption="Test grafico" subcaption="Qui e' possibile inserire una descrizione" yAxisName="asse Y - Valori " xAxisName="asse X - Pesi" showLegend="1" showNames="1" xAxisMaxValue="1" yAxisMinValue="-500000" showValues="1"  >
<categories verticalLineThickness="0.1">
    <category name="0.1" x="0.1" showVerticalLine="1"/>
    <category name="0.2" x="0.2" showVerticalLine="1"/>
    <category name="0.3" x="0.3" showVerticalLine="1"/>
    <category name="0.4" x="0.4" showVerticalLine="1"/>
    <category name="0.5" x="0.5" showVerticalLine="1"/>
    <category name="0.6" x="0.6" showVerticalLine="1"/>
    <category name="0.7" x="0.7" showVerticalLine="1"/>
    <category name="0.8" x="0.8" showVerticalLine="1"/>
    <category name="0.9" x="0.9" showVerticalLine="1"/>
    <category name="1" x="1" showVerticalLine="0"/>
</categories>
<dataSet id="PS" seriesName="Alternative" color="0372AB" plotBorderThickness="0" showPlotBorder="1" anchorSides="3" ><set id="INVEQ324_1" x="0.0" y="446931" tooltext="incrocio: 0.0, 446931 alternativa=3" />
<set id="INVEQ324_2" x="0.0" y="446931" tooltext="incrocio: 0.0, 446931 alternativa=3" />
<set id="INVEQ324_3" x="0.0" y="370638" tooltext="incrocio: 0.0, 370638 alternativa=2" />
<set id="INVEQ324_4" x="0.2" y="446931" tooltext="incrocio: 0.2, 446931 alternativa=3" />
<set id="INVEQ324_5" x="0.2" y="370638" tooltext="incrocio: 0.2, 370638 alternativa=2" />
<set id="INVEQ324_6" x="0.4" y="370638" tooltext="incrocio: 0.4, 370638 alternativa=2" />
<set id="INVEQ324_7" x="0.0" y="446931" tooltext="incrocio: 0.0, 446931 alternativa=3" />
<set id="INVEQ324_8" x="0.0" y="370638" tooltext="incrocio: 0.0, 370638 alternativa=2" />
<set id="INVEQ324_9" x="0.2" y="370638" tooltext="incrocio: 0.2, 370638 alternativa=2" />
<set id="INVEQ324_10" x="0.0" y="370638" tooltext="incrocio: 0.0, 370638 alternativa=2" />
</dataSet>
</chart>

 

Below the xml data with negative value on which I have the error:

<chart palette="3" caption="Test grafico" subcaption="Qui e' possibile inserire una descrizione" yAxisName="asse Y - Valori " xAxisName="asse X - Pesi" showLegend="1" showNames="1" xAxisMaxValue="1" yAxisMinValue="-500000" showValues="1"  >
<categories verticalLineThickness="0.1">
    <category name="0.1" x="0.1" showVerticalLine="1"/>
    <category name="0.2" x="0.2" showVerticalLine="1"/>
    <category name="0.3" x="0.3" showVerticalLine="1"/>
    <category name="0.4" x="0.4" showVerticalLine="1"/>
    <category name="0.5" x="0.5" showVerticalLine="1"/>
    <category name="0.6" x="0.6" showVerticalLine="1"/>
    <category name="0.7" x="0.7" showVerticalLine="1"/>
    <category name="0.8" x="0.8" showVerticalLine="1"/>
    <category name="0.9" x="0.9" showVerticalLine="1"/>
    <category name="1" x="1" showVerticalLine="0"/>
</categories>
<dataSet id="PS" seriesName="Alternative" color="0372AB" plotBorderThickness="0" showPlotBorder="1" anchorSides="3" ><set id="INVEQ324_1" x="0.0" y="-77794
" tooltext="incrocio: 0.0, -77794
 alternativa=3" />
<set id="INVEQ324_2" x="0.0" y="-77794
" tooltext="incrocio: 0.0, -77794
 alternativa=3" />
<set id="INVEQ324_3" x="0.0" y="-115644
" tooltext="incrocio: 0.0, -115644
 alternativa=2" />
<set id="INVEQ324_4" x="0.2" y="-77794
" tooltext="incrocio: 0.2, -77794
 alternativa=3" />
<set id="INVEQ324_5" x="0.2" y="-115644
" tooltext="incrocio: 0.2, -115644
 alternativa=2" />
<set id="INVEQ324_6" x="0.4" y="-115644
" tooltext="incrocio: 0.4, -115644
 alternativa=2" />
<set id="INVEQ324_7" x="0.0" y="-77794
" tooltext="incrocio: 0.0, -77794
 alternativa=3" />
<set id="INVEQ324_8" x="0.0" y="-115644
" tooltext="incrocio: 0.0, -115644
 alternativa=2" />
<set id="INVEQ324_9" x="0.2" y="-115644
" tooltext="incrocio: 0.2, -115644
 alternativa=2" />
<set id="INVEQ324_10" x="0.0" y="-115644
" tooltext="incrocio: 0.0, -115644
 alternativa=2" />
</dataSet>
</chart>

 

Thank in advance(I have search in forum but I don't have seen about this problem)

 

Giorgio

 

Share this post


Link to post
Share on other sites

Hi Giorgio,

 

Welcome to FusionCharts Forum.  :)

 

We tried to use the XML with negative values to render the JavaScript variant of Select Scatter chart and found that the chart renders fine at our end. Please refer the attached screenshot.

 

Also, there is no error seen in the browser console.

 

However, the chart appears to be having problem in its Flash variant ( no error seen though). We suggest you to to use JavaScript charts instead of Flash charts since JavaScript/HTML 5 charts provide better inter-browser operability. For converting your current Flash chart to JavaScript chart, you may use JavaScript alias name for chart creation instead of SWF file name.

 

Ref.

 

 var myChart = new FusionCharts("SelectScatter", "SelectChart", "550", "400", "1");

 

Hope this helps.

post-37797-0-41309000-1391515183_thumb.png

Share this post


Link to post
Share on other sites

Thank you very much now goes .

If I can I'd like to ask another thing about scatter and bubble chart.

From examples (http://docs.fusioncharts.com/charts/contents/index.html?AttDesc/BubbleScatter.html ) I see that it is possible put labels on bubble but if I do in javascript :

 

var datastring ='<chart caption="Portfolio of Investments in Equity"  subcaption="(diameter of bubble indicates quantity of equities held) "\n\
        xAxisName="Acquisition Price" yAxisName="Current Price" showValues="1" >\n\
  <categories>\n\
    <category x="0" />\n\
    <category label="$20" x="20" />\n\
    <category label="$40" x="40" />\n\
    <category label="$60" x="60" />\n\
    <category label="$80" x="80" />\n\
    <category label="$100" x="100" />\n\
    <category x="120" />\n\
  </categories>\n\
  <dataset>\n\
    <set x="7" y="30" z="1000" name="A" />\n\
    <set x="45" y="100" z="1500" name="B" />\n\
    <set x="72" y="100" z="500" name="C" />\n\
    <set x="95" y="40" z="800" name="D" />\n\
    <set x="105" y="150" z="900" name="E" />\n\
    <set x="25" y="35" z="600" name="F" />\n\
    <set x="15" y="50" z="800" name="G" />\n\
  </dataset>\n\
</chart>\n';

 

 var myChart = new FusionCharts("SelectScatter", "SelectChart", "550", "400", "1");

myChart.setXMLData(datastring );
myChart.render("chartdiv");

 

I obtain/see value and not name and not bubbles but triangles.

What I mistake ?

 

Thank in advance

 

Giorgio

 

 

 

post-62440-0-00208900-1391526723_thumb.png

Share this post


Link to post
Share on other sites

Hi,

 

Do you intend to use Bubble chart because I see the parameter "z" in your set element? If yes, then you need to use Bubble chart from FusionCharts XT pack.  For information on bubble chart, refer : http://docs.fusioncharts.com/charts/contents/index.html?ChartSS/Bubble.html

 

For rendering a bubble chart using your XML, please make the following change:

 

Ref.  var myChart = new FusionCharts("Bubble", "chart1", "550", "400", "1");

 

Please find the attached screenshot of the chart obtained after making the above said change.

 

Hope this helps.

post-37797-0-32206600-1391660485_thumb.png

Share this post


Link to post
Share on other sites

Thank you thank you very much : it is that displayValue that I forgot.

if it could be useful I have tried the example on the page without trend lines as follow :

 

var datastring ='<chart palette="3" numberPrefix="$" is3D="1" xAxisMaxValue="100" showPlotBorder="0" xAxisName="Stickiness"\n\
 yAxisName="Cost Per Service" chartRightMargin="30" showValues= "1">\n\
   <categories>\n\
      <category label="0%" x= "0"/>\n\
      <category label="20%" x="20" showVerticalLine="1"/>\n\
      <category label="40%" x="40" showVerticalLine="1"/>\n\
      <category label="60%" x="60" showVerticalLine="1"/>\n\
      <category label="80%" x="80" showVerticalLine="1"/>\n\
      <category label="100%" x="100" showVerticalLine="1"/>\n\
   </categories>\n\
   <dataSet >\n\
      <set x="30" y="1.3" z="1"  name="Traders" />\n\
      <set x="32" y="3.5" z="1" name="Farmers"/>\n\
      <set x="8" y="2.1"  z="1" name="Individuals"/>\n\
      <set x="62" y="2.5" z="1" name="Medium Business Houses"/>\n\
      <set x="78" y="2.3" z="1" name="Corporate Group A"/>\n\
      <set x="75" y="1.4" z="1" name="Corporate Group C"/>\n\
      <set x="68" y="3.7" z="1" name="HNW Individuals"/>\n\
      <set x="50" y="2.1" z="1" name="Small Business Houses"/>\n\
   </dataSet>\n\
</chart>\n';

 

and I have seen that dimension of bubble under some dimension don't resize that is z=100 or z=1 is the same if the size of bubbles is the same for all: is it correct ?

 

Thank you again

 

Giorgio

post-62440-0-17165000-1391694787_thumb.png

Edited by [email protected]

Share this post


Link to post
Share on other sites

Hi,

 

The "z" attribute depends on various factors like the width of the chart, chart margins etc.  So,the size of the bubble increases proportionately depending on the size of other bubbles.

 

Hence, if you set the size of all bubbles to the same value then they will have the same size, which is adjusted proportionately depending on the other factors like the width of the chart.

 

Hope this helps.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now