Creating a chart dashlet

To create a chart dashlet, you need to define the chart dashlet metadata XML.

Sample XML: chart dashlet metadata definition


<Dashlet id="chartdashlet" title="My Graph " type="extscreen">
			<Url>/platform/dashboard/chartdashlet.jsp</Url>
			<Imgurl>/stk/img/dashboard/chartdashlet.jpg</Imgurl>
			<Description>View data in Graph</Description>
			<Config>
						<Chart chartType="MSCombi2D" showAboutMenuItem="1"
  											rotateValues="1" caption="Monthly Flight expenses" xAxisName="Month"
  											yAxisName="Expense" yAxisMinValue="10" yAxisValuesStep="2"
  											yAxisMaxValue="2000" numberPrefix="Rs." enableSmartLabels="1" 
  											enableRotation="1" showValues="0" useRoundEdges="1"
  											formatNumberScale="1" showBorder="1" chartOrder="line,area,column"
													endAngX="35" endAngY="-20">
						</Chart>
						<Datasources>
									<Datasource mashupId="flightBookingGraphMashup" seriesName="expence" 
																					renderAs='Column'>
    					</Datasource>
 					</Datasources>
						<categories>
									<category label='JAN' />
									<category label='FEB' /> 
									<category label='MAR' />
									<category label='APR' /> 
									<category label='MAY' /> 
									<category label='JUN' />
									<category label='JUL' />
									<category label='AUG' />
									<category label='SEP' /> 
									<category label='OCT' />  
									<category label='NOV' />   
									<category label='DEC' />
						</categories>
			</Config>
</Dashlet> 
Attribute and element descriptions for the above sample are given below.
type
Specifies the type of screen being used for displaying the chart dashlet UI. By default, the chart dashlet provided by the Application Platform is of type extscreen.
URL
The URL used to get contents to render the chart dashlet.
Note: Ensure that the URL for chart dashlet is, /platform/dashboard/chartdashlet.jsp
Chart
The attributes of this element are valid FusionCharts chart attributes. For various chart specific attributes, refer to the FusionChart documentation.
Datasources/Datasource
A datasource is used to provide the dashlet with the relevant data to display as chart. One datasource corresponds to one series to be drawn in the chart. Using multiple datasources multiple series can be displayed in a chart. Moreover, a datasource definition has metadata to call a mashup. The input to the mashup is the datasource XML element and the output is expected to be an XML element. A datasource element has following attributes:
  • mashupId. The id of the mashup to be called.
  • seriesName. Used to define the series name.
  • renderAs. Used to define the series type.
Note: The Datasource output should be a valid dataset in the format expected by FusionCharts. For example:

<dataset>
<set label="label_1" value="001" />
<set label="label_2" value="002" />
</dataset> 
categories
Specify the categories as required by FusionChart to plot data on the axes.