You are viewing documentation for an older version. For current documentation - click here.

Here is a list of the functions defined in FusionCharts ASP Class (FusionCharts_Gen.asp). These functions create the required XML output based on the parameters passed through and make the chart rendering process easier for you.

FusionCharts ASP class functions can be divided under various heads, as shown in the list below:

 
Initializing Functions
 
Class Name : FusionCharts

Example Usage:

dim FC
set FC=new FusionCharts
 
setChartType(string chartType)

Sets the type of the chart.

Parameter:

  • chartType = type of the chart. To get the list of supported Chart Types, please click here.

Example:

dim FC
set FC = new FusionCharts
Call FC.setChartType("Column3D")
 
setSize(string width, string height)

Sets the height and width of the chart.

Parameters:

  • width = numeric value for chart width in pixels.
  • height = numeric value for chart height in pixels.

Example:

Call FC.setSize("300", "250")
 
setID(string chartID)

Sets unique ID for the chart. Required, to use chart's JavaScript APIs.

Parameter:

  • chartID = unique ID for the chart. Required to use chart's JavaScript APIs.

    To provide cross-browser compatibility, we recommend you not to start the ID with a numerical value, nor use space as part of the ID.

Example:

Call FC.setID("Chart1ID")

NOTE: If this function is not used, ASP automatically generates an ID using Session and assigns it to the chart. This ID is generated using a counter variable kept in session. Hence, on every page refresh new ID will be assigned to chart. You should provide an ID to interact with the chart later using JavaScript APIs like setDataXML(), setDataURL(), print(), saveAsImage() etc.

setTransparent(Boolean isTransparent)

Prepares the chart for transparent background. To set the chart transparent, you need to set the bgApha chart parameter using the setChartParam() or setChartParams() function.

Parameter:

  • isTransparent = (True/False) Prepares the chart for transparent background if set to true. To set the chart transparent, you need to set bgApha chart parameter using setChartParam() or setChartParams() function.

Example:

Call FC.setTransparent(True)
 
setRenderer(string renderer)

Sets the Rendering mode of the chart. A chart can render in either Flash or JavaScript mode.

Parameter:

  • renderer = Name of the rendering mode. Possible values are javascript or flash. By default, flash mode is set. However, in cases, where Flash Player is not found, the Renderer switches to javascript mode.

Example:

Call FC.setRenderer("javascript")
 
enablePrintManager(string directWriteToPage)

Enables Print Manager for Mozilla browsers. This function adds a small JavaScript snippet to the page which enables the Managed Print option for Mozilla based browsers.

Parameter:

  • directWriteToPage = An optional parameter which when set to true will write the code directly to page. Otherwise the code snippet is returned as string.
 
Returns a blank string when the code is directly written to page, otherwise, the JavaScript enabling the Print Manager is returned as string.

NOTE : The JavaScript which is generated from this code is as follows:

<script type=\"text/javascript\"><!--
  if(FusionCharts && FusionCharts.printManager) 
     FusionCharts.printManager.enabled(true);
    // -->
</script>
 
setWindowMode(string mode)

Explicitly sets window mode of a chart when rendered in flash mode. The possible window modes are - window, transparent and opaque. This setting will work only when chart is rendered in using flash renderer.

Parameter:

  • mode = Name of the window mode. Possible values are window, transparent, and opaque.. By default ,the chart is set to the opaque mode.

Example:

Call FC.setWindowMode('transparent')

NOTE:

Transparent mode can also be set using the constructor. This mode prepares the chart for transparent background. To set the chart transparent, you also need to set the bgApha chart parameter using the setChartParam() or setChartParams() function.

Back to top Back to Top
 
Public Functions
 
Other Setup Functions
 
setParamDelimiter(string strDelm)
 
Sets the delimiter for lists of chart attributes that are passed to functions like setChartParams, addDataset, addChartData etc. Delimiter is the character used to separate consecutive attributes for various chart elements. Default delimiter is semicolon (;).

Parameter:

  • strDelm = delimiter character. The character becomes reserved and cannot be used as normal character in chart attribute values.

Note: One can use this function any number of times in a single code block for a chart. By defining a new delimiter you can use the earlier delimiter as a regular character in chart attributes.

Example :

Call FC.setParamDelimiter("|")
Call FC.setChartParams("caption=Monthly Report|subCaption=June;July;September|bgColor=efefdd")
Call FC.setParamDelimiter("\n")
Call FC.addDataset("June", "color=009900\nshowValues=0") 
 
setSWFPath(string SWFPath)
 
Sets the path of the chart SWF file. Users may need to specify the relative file path of the SWF files while using them in different applications. This function allows users to set the path. The default path for SWF file is set to the application folder itself.

Parameter:

  • SWFPath = relative path of FusionCharts SWF file(s).

Example :

all FC.setSWFPath("FusionCharts/")
 
setChartMessage(string msgParam)

Sets various chart messages. For more on chart messages, please see the Changing chart messages page.

Parameter:

  • msgParam = chart messages attributes separated by delimiters. Messages attributes specified in Changing chart messages are used here. Note that the attribute values must not be enclosed in single or double quotes.

Example :

Call FC.setChartMessage("ChartNoDataText=Chart Data not provided;PBarLoadingText=Please Wait.The chart is loading...")
 
setInitParam( string tname, string tvalue)

Sets the chart’s initializing parameters and adds extra chart settings as well.

Parameters:

  • tname = name of the initializing parameters. Please refer to the table below for the list of parameter names.
  • tvalue = sets values for the initializing parameters. It can take any one of the several parameters listed below: Please refer to the table below for the possible values for each parameter name.

    Parameter Name Range/Value Description
    debugMode true/false If set to true, a debug window is displayed over the chart. 
    registerWithJS true/false If set to true, the chart will be registered with JavaScript. This will allow JavaScript to call chart's JavaScript API.
    bgcolor Hex Coded Color Background color of the chart. If background color of the chart is not defined in XML, this property will be used to set the chart’s background. E.g. #ff0000
    scaleMode noscale or exactfit or noborder or showall Scaling option of the chart. It can take any value out of the four: "noscale", "exactfit", "noborder" and "showall".
    lang   Preferred language, for example, EN

Example:

Call FC.setInitParam("debugmode",True)
Call FC.setInitParam("registerWithJS",False)
Call FC.setInitParam("bgColor","FF00FF")
Call FC.setInitParam("scalemode","noscale")
Call FC.setInitParam("lang","ENG")
 
setOffChartCaching(Boolean SWFNoCache)

Determines whether the chart SWF files are to be cached or not. If this function is not used, the browser will cache the charts. You can stop caching by setting the parameter to True.

Parameter:

  • SWFNoCache = (True/False) stops catching the chart SWF files if set to True.

Example:

Call FC.setOffChartCaching(True)
Back to top Back to Top
 
Generic Data Handling Functions
 
setChartParam(string paramName, string paramValue)

Sets a single attribute at a time for the chart. Attributes listed under the <chart> element section in Chart XML Reference can be used here.

Parameters:

  • paramName = name of the chart attribute.
  • paramValue = value of the chart attribute.

Example:

Call FC.setChartParam("caption","Monthly Sales")
 
setChartParams(string strParams)

Sets multiple attributes for the chart through one function. Multiple attributes from the <chart> element section of Chart XML Reference can be passed through this function.

Parameter:

  • strParams = delimiter separated list of attributes in string format. Note that the attribute values must not be enclosed in single or double quotes.

Example:

 Call FC.setChartParams("caption=Factory Sales;subCaption=Year 2007;bgColor=ffccff")
setCategoriesParams(string catParams)

Sets the attributes belong to the category set of a multi-Series chart. Attributes mentioned under the <categories> element in Chart XML Reference section can be set through this function.

Parameter:

  • catParams = delimiter separated list of attributes for chart categories. Note that the attribute values must not be enclosed in single or double quotes.

Example:

FC.setCategoriesParams("font=Arial;fontColor=ff0000")
addCategory(string label, string catParams, string vlineParams)

Adds one category label information at a time. This function is used only when creating non single series charts like multi-series, Stacked, Combination, multi-series Stacked, Scatter, and Bubble charts.

Parameters:

  • label = category name.
  • catParams = attributes of the category in string format. Attributes mentioned under the <category> element in Chart XML Reference section can be set through this. Note that the attribute values must not be enclosed in single or double quotes.
  • vlineParams = delimiter separated attributes for vline. Attributes mentioned under the <vline> element for <category> element in Chart XML Reference section can be set through this. Note that the attribute values must not be enclosed in single or double quotes.
    When this parameter is passed the previous two parameters are ignored. Please use this parameter alone, setting "" to the previous two parameters.

Example:

Call FC.addCategory("Week 1","","")
Call FC.addCategory("Week 2 ", "hoverText=Sales data for Second Week;ShowLabel=0","")

Add Vline:

Call FC.addCategory("","","color=FF0000")
 
addDataset(string seriesName, string datasetParams)

Adds a dataset to multi-series, Stacked, Combination, multi-series Stacked, Scatter, and Bubble charts.

Parameters:

  • seriesName = series name of the dataset.
  • datasetParams = delimiter separated attribute list of the series in string format. Attributes listed under the <dataset> element in the Chart XML Reference section can be passed through this. Note that the attribute values must not be enclosed in single or double quotes.

Note: Remember to add data values pertaining to the dataset immediately after using this function.

Example:

Call FC.addDataset("This Month","") 
Call FC.addChartData("40800","","") 
Call FC.addChartData("31400","","")       
Call FC.addDataset("Previous Month","") 
Call FC.addChartData("38300","","") 

In the above examples, data values '40800' and '31400' will be assigned to the dataset "This Month" and the data value '38300' will be assigned to the dataset "Previous Month".

addChartData(string value, string params, string vlineParams)

Provides chart data. For single series charts params must be passed having at least an attribute "label=foo". The parameter 'label' specifies the category label name for the data. For multi-series, stacked, combination and multi-series stacked charts params is optional. In these charts category label is defined using addCategory() function.

Parameters:

  • value = data value to be plotted over the chart.
  • params = list of dataplot attributes. Attributes listed under the <set> element in the Chart XML Reference section can be passed through this. Note that the attribute values must not be enclosed in single or double quotes.
  • vlineParams = delimiter separated attributes for vertical line or vline. When this parameter is passed the previous two parameters are ignored. Please use this parameter alone, setting "" to the previous two parameters.
    Attributes mentioned under the <vline> element in Chart XML Reference section can be set through this. Note that the attribute values must not be enclosed in single or double quotes.

Special Usage Cases:

  • For Scatter Chart the x value should be passed to value parameter, y value should be passed along with other dataplot attributes (if any) as a list of delimiter separated attributes. Example, addChartData("21","y=2.4;alpha=80")

  • For Bubble Chart the x value should be passed to value parameter, y value should be passed along with other dataplot attributes (if any) as a list of delimiter separated attributes. Example, addChartData("21","y=2.4;z=5;alpha=80")

Example:

For Single-Series Charts:

Call FC.addChartData("40800","label="Week 1","") 
Call FC.addChartData("31400","label="Week 2;color=ff0000;link=http://www.FusionCharts.com","") 

For Multi-Series Charts:

Call FC.addChartData("40800","")
Call FC.addChartData("31400","link=http://www.FusionCharts.com","")

Add Vline:

Call FC.addChartData("","","color=FF0000")
Back to top Back to Top
 
Chart Specific Functions
 
createMSStDataset()

Creates the primary dataset for multi-series stacked chart. Note that this function is applicable only for multi-series-Stacked Column 2D Chart and multi-series Stacked Column 2D Dual Y Chart.

Example:

Call FC.createMSStDataset()
 
addMSStSubDataset(string seriesName, string datasetParams)

Adds sub-dataset to multi-series stacked chart's primary dataset created using createMSStDataset() function. This function is applicable only for MultiSeries-Stacked Column 2D Chart and multi-series Stacked Column 2D Dual Y Chart.

Parameters:

  • seriesName = series name of the sub-dataset.
  • datasetParams = delimiter separated attribute list of the series in string format. Attributes listed under <dataset> element in the Chart XML Reference section can be passed through this. The attribute values must not be enclosed in single or double quotes.

Note: Remember to use this function immediately after the createMSStDataset() function and add data values pertaining to the dataset immediately after using this function.

Example:

'Add primary dataset
Call FC.createMSStDataset()       
'Add sub-dataset within a primary dataset
Call FC.addMSStSubDataset("Product  A", "")        
'Add data for 'Product  A'
Call FC.addChartData("30","","")
Call FC.addChartData("26","","")
 
addMSLineset(string seriesName, string linesetParams)

Adds lineset to multi-series stacked chart. This line goes as per Secondary Y Axis Scale. Note that this function is applicable only for multi-series Stacked Column 2D Dual Y Chart.

Parameters:

  • seriesName = series name of the lineset.
  • linesetParams = delimiter separated attribute list of the series in string format. Attributes listed under the <lineset> element in the Chart XML Reference section can be passed through this. Note that the attribute values must not be enclosed in single or double quotes.

Note: The data for the lineset declared using this function is added using the addMSLinesetData()function.

Example:

'Add a lineset 
FC.addMSLineset("Cost as %25  of Revenue","lineThickness=4")

'Add  data for lineset
Call FC.addMSLinesetData("57","")
Call FC.addMSLinesetData("68","")
 
addMSLinesetData(string value, string params, string vlineParams)

Adds a line to multi-series stacked chart's lineset. This function is applicable only for Multi-Series Stacked Column 2D Dual Y Chart.

Parameters:

  • value = data value to be plotted over the chart.
  • params = list of dataplot attributes. Attributes listed under <set> element in the Chart XML Reference section can be passed through this. Note that the attribute values must not be enclosed in single or double quotes.
  • vlineParams = delimiter separated attributes for vertical line or vline. When this parameter is passed the previous two parameters are ignored. Please use this parameter alone, setting "" to the previous two parameters.
    Attributes mentioned under the <vline> element in Chart XML Reference section can be set through this. Note that the attribute values must not be enclosed in single or double quotes.

Note: Remember to use this function immediately after addMSLineset() function.

Example:

'Add  lineset 
Call FC.addMSLineset("Cost as %25 of  Revenue","lineThickness=4")        
'Add  data for lineset
Call FC.addMSLinesetData("57","","")
Call FC.addMSLinesetData("68","","")
 
setGridParams(string gridParams)

Sets the chart’s parameters. Note that you cannot use the setChartParam() or setChartParams() function to set Grid chart’s parameters. This function is applicable only for grid chart.

Parameter:

  • gridParams = delimiter separated attributes for grid. For more on grid parameters please go through: “Grid Component” -> “Grid Parameters”.

Example:

Call FC.setGridParams ("showPercentValues=1;showShadow=1")
Call FC.setGridParams ("numberItemsPerPage=6")
Back to top Back to Top
 
Trendlines and Vtrendlines Functions
 
addTrendLine(string tlineParams)

Adds a trendline in the chart. All attributes for the <line> element of <trendlines> element like startValue, endValue, color, displayValue, isTrendZone, showOnTop etc. are passed here.

Parameter:

  • tlineParams = delimiter separated attributes for trend line. Attributes mentioned under the <line> element for the <trendlines> element in Chart XML Reference section can be set through this. Note that the attribute values must not be enclosed in single or double quotes.

Example :

 Call FC.addTrendLine("startValue=89.5;endValue=98;color=FF0000;displayvalue=Roll. Avg.;
                       thickness=2;alpha=100;isTrendZone=0;showOnTop=1")
 
addVTrendLine(string vtlineParams)

Adds a vertical trendline to Bubble Chart or Scattered Chart. All attributes for the <line> element of <vtrendlines> element, for example, startValue, endValue, color, displayValue, isTrendZone, showOnTop, etc. can be passed here.

Parameters:

  • vtlineParams = delimiter separated attributes for vertical trend line. Attributes mentioned under the <line> element for <vtrendlines> element in Chart XML Reference section can be set through this. Note that the attribute values must not be enclosed in single or double quotes.

Examples:

Call FC.>addVTrendLine("startValue=35;endValue=36")       
Call FC.addVTrendLine("startValue=0;endValue=20;alpha=5;color=00FF00")
 
Back to top Back to Top
 
Colors & Styles Functions
 
defineStyle(string styleName, string styleType, string styleParams)

Defines chart's style. A style needs to be defined first and then apply to chart a object using the applyStyle()function.

Parameters:

  • styleName = a name of the style to be defined. It can take alphanumeric value and be passed through applyStyle() function.
  • styleType = type of the style. The values for style types are: “bevel”, “glow”, “font”, “animation” and “shadow”.
  • styleParams = delimiter separated attributes for style type. Attributes mentioned under the <style> element for <definition> element in the <styles> element can be passed through this. For more on these attributes, please see the “How to Use?” section in the "FusionCharts XT Styles" section.

Example:

Call FC.defineStyle("MyFirstFontStyle", "font", "font=Verdana; size=12; color=FF0000; bgColor=FFFFDD;borderColor=666666")         
Call FC.defineStyle("MyFirstGlow","Glow","color=FF5904;alpha=75")
 
applyStyle(string toObject, string styles)

Applies a style, defined by the defineStyle function, to chart objects.

Parameters:

  • toObject = chart object where the style is to be applied. To get the names of the chart objects please see the page: "Chart XML Reference". Note that toObject can take only one object name at a time.
  • styles = one or more style names that are defined using the defineStyle function.

Example:

'Define First Style element named MyFirstFontStyle
Call FC.defineStyle("MyFirstFontStyle","font","font=Verdana;size=12;color=FF0000;  bgColor=FFFFDD;borderColor=666666")      
'Define Second  Style element named - MyFirstGlow
Call FC.defineStyle("MyFirstGlow","Glow","color=FF5904;alpha=75")          
'Apply Style
Call FC.applyStyle("CAPTION","MyFirstFontStyle")       
'Apply  Style
Call FC.applyStyle("YAXISNAME","MyFirstGlow")
'One can add multiple style in one item using applyStyle function by this way:
Call FC.applyStyle("XAXISNAME",  "MyFirstGlow, MyFirstFontStyle")
 
addColors(string colorList)

Adds and apply user-defined colors to chart dataplots. Although FusionCharts XT has a set of colors by default, this function allows the developers to provide own set of colors.

Parameter:

  • colorList = delimiter separated list of hexcoded colors. Note that the hexcoded colors should not be prefixed by #.

Example:

Call FC.addColors("FF0000;00FF00;0000FF;FFFF00;00FFFF")
 
clearUserColor()

Clears the color(s) that has been added using addColors function.

Example:

Call FC.clearUserColor()
 
Back to top Back to Top
 
Array Handling Functions
 
addCategoryFromArray(string categoryArray)

Adds chart category labels from array.

Parameter:

  • categoryArray = one dimensional array of string type containing category labels.

Example:

' Category Array List
dim categoryArray(4)
categoryArray(0)="Week 1"
categoryArray(1)="Week 2"
categoryArray(2)="Week 3"
categoryArray(3)="Week 4"
' Add category names
Call FC.addCategoryFromArray(categoryArray)
 
addChartDataFromArray(byval string() dataArray, array dataCatArray)

Adds chart data from array(s). We can use this function for both Single Series and Multi Series charts; however, the structure of the dataArray should be different for single and multi-series charts. Also, the second parameter dataCatArray is required only for Multi Series or Combination Charts.

Parameters:

dataArray (required for both Single Series and Multi Series/Stacked/Combination charts)

For Single Series charts a two dimensional array (n rows x 2 columns):

  1. First Column stores Category Names.
  2. Second Column stores data values.

For MultiSeries/Stacked/Combination charts:

  1. First Column stores Dataset Names.
  2. Second Column stores Dataset Attributes (compulsory for combination chart)
  3. Rest of the columns store data values for the dataset

 dataCatArray (required only for Multi Series/Stacked/Combination charts)

  1. Category names stored in a single dimensional array.

Example:

Single Series Chart:

dim arrData(4, 2)      
'Add Category labels 
arrData(0, 0)="Week 1" 
arrData(1, 0)="Week 2"
arrData(2, 0)="Week 3"
arrData(3, 0)="Week 4"     
'Add chart Data 
arrData(0, 1)="100"
arrData(1, 1)="200"
arrData(2, 1)="300"
arrData(3, 1)="400"     
Call FC.addChartDataFromArray(arrData, "")

Multi-Series/Stacked/Combination Charts:

dim arrCatNames(4)
dim arrData(2, 6)
'Store Name of Products as category labels        
arrCatNames(0) = "Week 1" 
arrCatNames(1) = "Week 2" 
arrCatNames(2) = "Week 3" 
arrCatNames(3) = "Week 4" 
'Store sales data for current month
arrData(0, 0) = "Current Month"  'Series Name 
arrData(0, 1) = "color=ff0000"   'Dataset Parameters         
arrData(0, 2) = 567500
arrData(0, 3) = 815300
arrData(0, 4) = 556800 
arrData(0, 5) = 734500    
'Store sales data for previous month 
arrData(1, 0) = "Previous Month" 
'Series Name 
arrData(1, 1) = "color=0000ff" 
'Dataset Parameters       
arrData(1, 2) = 547300
arrData(1, 3) = 584500 
arrData(1, 4) = 754000 
arrData(1, 5) = 456300    
Call FC.addChartDataFromArray( arrData, arrCatNames)

For detailed examples on FusionCharts ASP Class' Array Handling function please go through the Using with ASP Class section.

Back to top Back to Top
 
Database Handling Functions
 
addCategoryFromDatabase(recordset oRs , string categoryColumn)

Creates the set of chart Category Names from database for database driven multi-series charts.

Parameters:

  • oRs = SQL query result as recordset.
  • categoryColumn = database field name for category names.

Example:

strQuery = "select distinct weekNames from Sales"
dim recordset
Set recordset = Server.CreateObject("ADODB.Recordset")
recordset.open strQuery,oConn,1,1,1      
Call FC.addCategoryFromDatabase( recordset, "weekNames")

For detailed examples on FusionCharts ASP Class' Database Handling functions please go through the section Using with ASP Class

addDatasetsFromDatabase(resource query_result, string ctrlField, string valueField, array datasetParamArray, string link)

Adds datasets with data values for each dataset (only for multiseries/stacked/combination charts) from database.

Parameters:

  • query_result = SQL query result to fetch dataset from database.
  • ctrlField = Control Break field. The database field that contains all series names in sorted order; the function uses this parameter to pick series names for multiple datasets.
  • valueField = the field that contains the dataset values.
  • datasetParamArray =an array that stores delimiter separated list of attributes for each dataset.
  • link = (Optional) Adds hyperlink feature to dataplots. This adds the link attribute to dataplots or <set> elements. It can be a simple URL say, "http://www.google.com" or another page say, "Drill/Detailed.asp" etc. For details on drill down and creating links using FusionCharts XT, please go through the section Drill Down Charts.

    This parameter has a link place holder format that helps creating dynamic links. Anything placed between ## and ##
    (for example, . FactoryID in "Detailed.asp?FId=##FactoryID##") will be regarded as a field/column name in the SQL query result. Value from that column will dynamically replace that place holder. Hence, for each dataplot in the chart the link values will be different.

    For detailed example on this feature, please refer to Creating Drilldown charts in "Using With ASP Class" section.

Note: The control Break field must be sorted.

Example:

strQuery = "select  weekNames,revenue from Sales order by weekNames"
dim recordset
Set recordset = Server.CreateObject("ADODB.Recordset")
recordset.open strQuery,oConn,1,1,1      
Call FC.addDatasetsFromDatabase( result, "weekNames", "revenue", "", "")

For detailed examples on FusionCharts ASP Class' Database Handling functions please go through the section Using with ASP Class

addDataFromDatabase(resource query_result, string db_field_ChartData, string db_field_CategoryNames, string strParam, string link)

Adds chart data and category names from database. This function is specially designed for single-series charts, but can be used to provide chart values for a single dataset in multi-series/stacked/combination charts.

Parameters:

  • query_result = SQL query result to fetch dataset from database.
  • db_field_ChartData = database field that contains data values.
  • db_field_CategoryNames = database field that contains category names.(Optional for multi-series/stacked/combination charts)
  • strParam = delimiter separated attribute list for dataplots.
  • link = Adds hyperlink feature to dataplots. This adds the link attribute to dataplots or <set> elements.It can be a simple URL say, "http://www.google.com" or another page say, "Drill/Detailed.asp" etc. For details on drill down and creating links using FusionCharts XT, please go through the section Drill Down Charts.

    This parameter has a link place holder format that helps creating dynamic links. Anything placed between ## and ##
    (for example, . FactoryID in "Detailed.asp?FId=##FactoryID##") will be regarded as a field/column name in the SQL query result. Value from that column will dynamically replace that place holder. Hence, for each dataplot in the chart the link values will be different.

    For detailed example on this feature, please refer to Creating Drilldown charts in "Using With ASP Class" section.

Example:

strQuery = "select  weekNames,revenue from Sales order by weekNames where CMonth=1" 
dim recordset
Set recordset = Server.CreateObject("ADODB.Recordset")
recordset.open strQuery,oConn,1,1,1   
Call FC.addDataFromDatabase( recordset,  "revenue", weekNames", "", "")

For detailed examples on FusionCharts ASP Class' Database Handling functions please go through the section Using with ASP Class

Back to top Back to Top
 
XML Generating & Chart Rendering Functions
 
string getXML()

This function is used to get the full XML required for chart generation. FusionCharts ASP Class functions build specific parts of chart XML. getXML() function assembles those parts and returns the full XML. Users can use this XML to render charts in dataURL method.

Return Type:

  • Chart XML as string.

Example:

 xml= Call FC.getXML()
 
renderChart(Boolean renderASHTML)

This function builds the full XML required for chart generation and also renders chart based on chart type, width and height as specified. This function does not accept any parameter, nor does it return any value.

Parameter:

  • renderAsHTML = (True/False) renders the chart using HTML embedding method if set to True. Note that this method does not make use of FusionCharts.JS. This HTML embedding method is helpful where JavaScript is disabled or in AJAX Portback.

Example:

Call FC.renderChart(True)
 
renderChartFromExtXML(string dataXML, Boolean renderAsHTML)

This method is deprecated. Please use renderChartFromExtData() instead.

Renders chart from XML which has not been created in the program. After creating chart object and setting relative SWF file path, this function can be used where the full XML is passed through.

Parameter:

  • dataXML = full XML for chart rendering in string format
  • renderAsHTML = (True/False) renders the chart using HTML embedding method if set to True.

Example:

dim FC
dim xml 
xml="<chart><set value='100' name='Product A' /><set value='120' name='Product B' /></chart>" 
set FC=new FusionCharts
Call FC.setChartType("Column3D") 
Call FC.setSize("300","250")    
Call FC.renderChartFromExtXML(xml)
 
renderChartFromExtData(string data, string dataformat, Boolean renderAsHTML)

Renders chart from data which has not been created through the class. After creating chart object and setting relative chart file path, this function can be called to set complete XML or JSON to the chart. 

The XML or JSON data needs to be passed as string.

To know more on XML, please read FusionCharts XT Data Formats > XML section.
To know more on JSON, please read FusionCharts XT Data Formats > JSON section.

Parameter:

  • data = full XML/JSON data for chart rendering. The data should be provided in string format
  • dataformat = defines the data type of the data passed through this function. The possible values are xml and json. The default value is xml.
  • renderAsHTML = renders the chart using HTML embedding method if set True. This setting is not applicable if json data is used.

Example:

Dim FC
Dim data : data = "{'chart':{'caption':'Weekly Sales Summary'},'data':[{'label':'Week 1','value':'14400'},{'label':'Week 2','value':'19600'}]}"

set FC=new FusionCharts 
Call FC.setChartType("Column3D")  
Call FC.setSize("300","250")     
Call FC.renderChartFromExtData(data, 'json' , False)