Basic use of fusioncharts in Java (2)

Source: Internet
Author: User

V. XML form of a single sequence

Example:

<Graph basefont = 'sunsim 'basefontsize = '12' caption = 'analytic' subcaption = ''' yaxisminvalue = '2017. 1 'axismaxvalue = '71118. 3 'axisname = 'date' yaxisname = 'qty 'hovercapbg = 'ffecaa' hovercapborder = 'f47e00' formatnumberscale = '0' decimalprecision = '0' showvalues = '1' numdivlines =' 10 'numvdivlines = '0' shownames = '1' rotatenames = '1'> <br/> <set name = '2017-10-04 'value = '000000' color = 'afd8f8 '/> <br/> <set name = '2017-10-05' value = '000000' color = 'f6bd0f'/> <br/> <set name = '2017-10-06 'value = '000000' color = '8bba00'/> <br/> <set name = '2017-10-07 'value = '000000' color = 'ff8e46'/> <br /> <set name = '2017-10-08 'value = '000000' color = '008e8e'/> <br/> <set name = '2017-10-09 'value = '2017 'color = 'd64646 '/> <br/> <set name = '2017-10-10' value = '000000' color = '8e468e '/> <br/> <Set Name = '2017-10-11 'value = '000000' color = '000000'/> <br/> </graph>

<Graph> tag attributes:

Basefont: font of the chart

Basefontsize: the font size of the chart.

Caption: Title

Subcaption: subtitle

Yaxisminvalue: Minimum value of Y axis

Yaxismaxvalue: maximum value of Y axis

Hovercapbg: Specifies the background color displayed when you hover the mouse over the mouse.

Hovercapborder: border color when hovering

Formatnumber (0/1): whether to use commas to separate (1); 0: No)

Formatnumberscale (0/1): whether to add K and m to numbers (1 -- add, 0 -- do not add)

Decimalprecision: number of digits in decimal places

Showvalues (0/1): whether to display the value

Numdivlines: Number of horizontal gridlines

Numvdivlines: number of lines displayed on the vertical network line

Shownames (0/1): whether to display the name of each data on the X axis

Rotatenames (0/1): whether to rotate the name of each data on the X axis

Rotateyaxisname (0/1): whether to display the name of the Y axis

Showalternatehgridcolor (0/1): whether to display alternating grid colors

 

<Set> tag:

Name: name of each data on the X axis

Value: Value

 

Data in XML format of a single sequence can be used for several graphs.

(1) pie diagram

Fcf_pie2d.swf fcf_pie3d.swf

(2) Area Chart

Fcf_area2d.swf

(3) bar chart

Fcf_bar2d.swf

(4) column chart

Fcf_column2d.swf fcf_column3d.swf

(5) line chart

Fcf_line.swf

(6) doughnut Diagram

Fcf_doughnut2d.swf


Vi. Multi-sequence XML format

Example:

<Graph basefont = 'sunsim 'basefontsize = '12' caption = 'analytics' subcaption = '''axisminvalue = '0' yaxismaxvalue = '000000' xaxisname = 'region' <br/>' yaxisname = 'number' hovercapbg = 'ffecaa 'hovercapborder = 'f47e00' formatnumberscale = '0' decimalprecision = '0' showvalues = '1' <br/> numdivlines = '10' numvdivlines = '0' shownames = '1' rotatenames = '1'> <br/> <categories font = 'arial' fontsize = '11' fontcolor = '000000'> <br/> <category name = 'n. america 'hovertext = 'North America '/> <br/> <category name = 'air'/> <br/> <category name = 'Europe'/> <br/> <category name = 'Australia '/> <br/> <category name = 'aar'/> <br/> </Categories> <br/> <dataset seriesname = 'Rice 'color = 'fdc12e' alpha = '000000'> <br/> <set value = '30'/> <br/> <set value = '26'/> <br /> <set value = '29'/> <br/> <set value = '31'/> <br/> <set value = '34'/> <br/> </dataset> <br/> <dataset seriesname = 'wheel' color = '56b9f9' showvalues = '1' alpha = '000000'> <br/> <set value = '67'/> <br/> <set value = '98 '/> <br/> <set value = '79'/> <br/> <set value =' 73 '/> <br/> <set value = '80'/> <br/> </dataset> <br/> <dataset seriesname = 'grain' color = 'c9198d 'showvalues = '1' alpha = '000000'> <br/> <set value = '27'/> <br/> <set value = '25'/> <br /> <set value = '28'/> <br/> <set value = '26'/> <br/> <set value = '10'/> <br/> </dataset> <br/> </graph>

 

<Graph> basically, the XML format of a single sequence

<Categroies> specifies the types of the X axis.

<Categroy> corresponds to a type.

Name: type name

<Dataset> indicates a sequence set. The number of values in the sequence set is the same as that in category.

Seriesname: sequence name

<Set>: A Sequence Value.

 

Data in XML format of Multiple sequences can be used for several graphs.

(1) Area Chart

Fcf_msarea2d.swf

(2) bar chart

Fcf_msbar2d.swf

(3) column chart

Fcf_mscolumn2d.swf fcf_mscolumn3d.swf

(4) line chart

Fcf_msline.swf

(5) stacked Diagram

Fcf_stackedarea2d.swf

Fcf_stackedbar2d.swf

Fcf_stackedcolumn2d.swf fcf_stackedcolumn3d.swf


7. classes that generate the preceding XML

Public class fusionchartsxmlgenerator {</P> <p> Public static final int boolean_true = 0; <br/> Public static final int boolean_false = 1; <br/> Private Static logger = loggerfactory. getlogger (fusionchartsxmlgenerator. class); </P> <p> Private Static fusionchartsxmlgenerator Singleton = new fusionchartsxmlgenerator (); </P> <p> Public static fusionchartsxmlgenerator getinstance () {<br/> return singleto N; <br/>}</P> <p> private fusionchartsxmlgenerator () {}</P> <p> private string [] colors = {"afd8f8 ", "f6bd0f", "8bba00", "ff8e46", "008e8e", <br/> "d64646", "8e468e", "588526", "b3aa00", "008ed6 ", "9d080d", "a186be"}; </P> <p>/** <br/> * Data Format: <br/> * "" category1, category2, category3... --------> This is the first line <br/> * type1 value1, value2, value3 ,... <br/> * type2 value1, value2, value3 ,... <br/> *...... <br/> */< Br/> Public String getmultidsxml (list <string> data, <br/> string caption, string subcaption, <br/> string xaxisname, string yaxisname, <br/> int shownames, int showvalues, <br/> int decimalprecision, int rotatenames) {<br/> double max =-double. max_value, min = double. max_value; <br/> for (INT I = 1; I <data. size (); I ++) {<br/> List ROW = (list) data. get (I); <br/> for (Int J = 1; j <row. size (); j + +) {<Br/> string val = (string) Row. Get (j); <br/> If (Val! = NULL & Val. length ()> 0) {<br/> Double V = double. parsedouble (VAL); <br/> If (V> MAX) {<br/> max = V; <br/>}< br/> If (v <min) {<br/> min = V; <br/>}</P> <p> If (max =-double. max_value) {<br/> max = 0; <br/>}</P> <p> If (min = double. max_value) {<br/> min = 0; <br/>}</P> <p> If (min = max & min = 0) {<br/> min = 0; <br/> max = 100; <br/>}</P> <p> max = math. ABS (max/10) + Max; <br/> min = min-math. ABS (min/10); </P> <p> int valcnt = (list) data. get (0 )). size ()-1; <br/> If (valcnt> 30) {<br/> shownames = 0; <br/> showvalues = 0; <br/>}</P> <p> stringbuffer strxml = new stringbuffer (); <br/> strxml. append ("<graph basefont = 'sunsim 'basefontsize = '12' caption ='" + <br/> caption + "'subcaption = '" + subcaption + "'" + <br/> "yaxisminvalue = '" + min + "'axismaxvalue ='" + MAX + "'" + <br/> "xaxisname ='" + xaxisname + "'yaxisname = '"+ yaxisname +"' hovercapbg = 'ffecaa '"+ <br/>" hovercapborder = 'f47e00' formatnumberscale = '0' decimalprecision =' "+ decimalprecision +" '"+ <br/> "showvalues = '" + showvalues + "'numdivlines = '10' numvdivlines = '0'" + <br/> "shownames ='" + shownames + "' rotatenames = '"+ rotatenames +"' "+ <br/>" rotateyaxisname = '0' showalternatehgridcolor = '1'> "); </P> <p> strxml. append ("<categories>"); <br/> List headerrow = (list) data. get (0); <br/> for (INT I = 1; I <peaderrow. size (); I ++) {<br/> strxml. append ("<category name = '" + headerrow. get (I) + "'/>"); <br/>}< br/> strxml. append ("</Categories>"); </P> <p> for (INT I = 1; I <data. size (); I ++) {<br/> List ROW = (list) data. get (I); <br/> string name = (string) Row. get (0); <br/> string color = colors [(I-1) % 12]; <br/> strxml. append ("<dataset seriesname = '" + name + "'" + <br/> "color = '" + color + "'anchorbordercolor ='" + color + "'" + <br/> "anchorbgcolor = '" + color + "'> "); <br/> for (Int J = 1; j <row. size (); j ++) {<br/> strxml. append ("<set value = '" + (string) Row. get (j) + "'/>"); <br/>}< br/> strxml. append ("</dataset>"); <br/>}</P> <p> strxml. append ("</graph>"); <br/> string STR = strxml. tostring (); <br/> logger.info ("=/N" + STR + "/N = =/N "); <br/> return STR; <br/>}</P> <p>/** <br/> * the data format is: <br/> * name value <br/> *...... <br/> */<br/> Public String getsingledsxml (list <string> data, <br/> string caption, string subcaption, <br/> string xaxisname, string yaxisname, <br/> int shownames, int showvalues, <br/> int decimalprecision, int rotatenames) {</P> <p> double max =-double. max_value, min = double. max_value; <br/> for (INT I = 0; I <data. size (); I ++) {<br/> List <string> ROW = data. get (I); <br/> double value = double. parsedouble (row. get (1); <br/> If (value> MAX) {<br/> max = value; <br/>}< br/> If (value <min) {<br/> min = value; <br/>}</P> <p> If (max =-double. max_value) {<br/> max = 0; <br/>}</P> <p> If (min = double. max_value) {<br/> min = 0; <br/>}</P> <p> If (min = max & min = 0) {<br/> min = 0; <br/> max = 100; <br/>}</P> <p> max = math. ABS (max/10) + Max; <br/> min = min-math. ABS (min/10); </P> <p> int valcnt = data. size ()-1; <br/> If (valcnt> 30) {<br/> shownames = 0; <br/> showvalues = 0; <br/>}</P> <p> stringbuffer strxml = new stringbuffer (); <br/> strxml. append ("<graph basefont = 'sunsim 'basefontsize = '12' caption ='" + <br/> caption + "'subcaption = '" + subcaption + "'" + <br/> "yaxisminvalue = '" + min + "'axismaxvalue ='" + MAX + "'" + <br/> "xaxisname ='" + xaxisname + "'yaxisname = '"+ yaxisname +"' hovercapbg = 'ffecaa '"+ <br/>" hovercapborder = 'f47e00' formatnumberscale = '0' decimalprecision =' "+ decimalprecision +" '"+ <br/> "showvalues = '" + showvalues + "'numdivlines = '10' numvdivlines = '0'" + <br/> "shownames ='" + shownames + "' rotatenames = '"+ rotatenames +"' "+ <br/>" rotateyaxisname = '0' showalternatehgridcolor = '1'> "); <br/> for (INT I = 0; I <data. size (); I ++) {<br/> List <string> ROW = data. get (I); <br/> string label = row. get (0); <br/> string value = row. get (1); <br/> string color = colors [I % 12]; <br/> strxml. append ("<set name = '" + label + "'value ='" + value + "'color = '" + color + "'/> "); </P> <p >}< br/> strxml. append ("</graph>"); <br/> string STR = strxml. tostring (); <br/> logger.info ("=/N" + STR + "/N = =/N "); <br/> return STR; <br/>}< br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.