ALIAS: sparkline
Example of Spark Line Chart:
JavaScript embedding code:
<script type="text/javascript"> FusionCharts.ready(function(){ var myChart = new FusionCharts({ "type": "sparkline", "dataFormat": "jsonurl", "dataSource": "chartdata.json" }); }); </script>
Data for this chart:
Chart Attributes
Functional Attributes
These attributes let you control a variety of functional elements on the chart. For example, you can opt to show/hide data labels, data values, y-axis values. You can also set chart limits and extended properties.
Name | Type | Range | Description |
---|---|---|---|
animation |
Boolean | 0/1 | This attribute lets you set the configuration whether the chart should appear in an animated fashion. If you do not want to animate any part of the chart, set this as 0. |
connectNullData |
Boolean | 0/1 | This attributes lets you control whether empty datasets in your data will be connected to each other OR will they appear as broken datasets? |
setAdaptiveYMin |
Boolean | 0/1 | This attribute lets you set whether the y-axis lower limit will be 0 (in case of all positive values on chart) or should the y-axis lower limit adapt itself to a different figure based on values provided to the chart. |
yAxisMinValue |
Number | Numeric Value | This attribute helps you explicitly set the lower limit of the chart. If you don't specify this value explicitly, the chart automatically calculates the lower limit based on the data provided by you. |
yAxisMaxValue |
Number | Numeric Value | This attribute helps you explicitly set the upper limit of the chart. If you don't specify this value explicitly, the chart automatically calculates the upper limit based on the data provided by you. |
clickURL |
URL in FusionCharts format | The entire chart can now act as a hotspot. Use this URL to define the hotspot link for the chart. The link can be specified in FusionCharts Link Format. | |
palette |
Number | 1-5 | Each chart has 5 pre-defined color palettes which you can choose from. Each palette renders the chart in a different color theme. |
paletteThemeColor |
Color Code | Hex Code | If you want your own palette derived from a particular hex color, you can specify the same here. All other colors on the chart will automatically derive from that palette. |
annRenderDelay |
Number | In seconds | If you've defined any annotation groups over the chart, using this attribute you can set the duration after which they'll render on the chart. The timer starts from the time the chart has initialized. |
showPrintMenuItem |
Boolean | 0/1 | Whether to show "Print Chart" item in the context menu of the chart? Even if you opt to hide the item in context menu, you can still opt to invoke `print()` JavaScript method of the chart to print the same. |
manageResize Since 3.2 |
Boolean | 0/1 | Setting this attribute to 1, you can allow the chart to automatically resize itself when the parent container of the chart is resized. |
useEllipsesWhenOverflow Since 3.2 |
Boolean | 0/1 | When enabled in auto mode, long data labels are truncated by adding ellipses to prevent them from overflowing the chart background. The default value is 1. |
Chart Caption
These attributes let you configure the chart caption and sub-caption.
Name | Type | Description |
---|---|---|
caption |
String | Caption of the chart. |
subCaption |
String | Sub-caption of the chart. |
Chart Caption Cosmetics
These attributes let you customize the cosmetic properties for the chart caption and sub-caption.
Name | Type | Range | Description |
---|---|---|---|
captionAlignment |
String | "left", "center", "right" | Sets horizontal alignment of caption |
captionOnTop |
Boolean | 0/1 | Whether caption should be on top of the data plot area |
captionFontSize |
Number | 0 - 72 | Sets the caption font size in pixels |
subCaptionFontSize |
Number | 0 - 72 | Sets the sub-caption font size (in pixels) |
captionFont |
String | Font Name | Sets the caption font family |
subCaptionFont |
String | Font Name | Sets the sub-caption font family |
captionFontColor |
Color | Hex Code | Sets the caption font color |
subCaptionFontColor |
Color | Hex Code | Sets the sub-caption font color |
captionFontBold |
Boolean | 0/1 | Whether the caption font should be displayed in bold |
subCaptionFontBold |
Boolean | 0/1 | Whether the sub caption font should be displayed in bold |
alignCaptionWithCanvas |
Boolean | 0/1 | Whether the caption is aligned with the canvas. Else, it will be aligned with the entire chart area |
captionHorizontalPadding |
Number | In Pixels | If caption is not centre aligned, lets you configure the padding (in pixels) from either edge. Will be ignored if caption is centre aligned. |
Number Formatting Properties
FusionCharts XT offers you a lot of options to format your numbers on the chart.
These attributes let you control a myriad of options like:
- Formatting of commas and decimals
- Number prefixes and suffixes
- Decimal places to which the numbers will round to
- Scaling of numbers based on a user defined scale
- Custom number input formats
These attributes let you appropriately format the numbers displayed on the chart.
Name | Type | Range | Description |
---|---|---|---|
formatNumber |
Boolean | 0/1 | This configuration determines whether the numbers displayed on the chart will be formatted using commas, e.g., 40,000 if `"formatNumber":"1" `and 40000 if `"formatNumber":"0".` |
numberPrefix |
String | Using this attribute, you could add prefix to all the numbers visible on the graph. For example, to represent all dollars figure on the chart, you could specify this attribute to ' $' to show like $40000, $50000. | |
numberSuffix |
String | Using this attribute, you could add suffix to all the numbers visible on the graph. For example, to represent all figures quantified as per annum on the chart, you could specify this attribute to ' /a' to show like 40000/a, 50000/a. | |
decimals |
Number | Number of decimal places to which all numbers on the chart will be rounded to. | |
forceDecimals |
Boolean | 0/1 | Whether to add 0 padding at the end of decimal numbers? For example, if you set decimals as 2 and a number is 23.4. If `forceDecimals` is set to 1, the number will automatically be converted to 23.40 (note the extra 0 at the end). |
formatNumberScale |
Boolean | 0/1 | Configuration whether to add K (thousands) and M (millions) to a number after truncating and rounding it - e.g., if `formatNumberScale` is set to 1, 1043 will become 1.04K (with decimals set to 2 places). Same with numbers in millions - an M will be added at the end. |
defaultNumberScale |
String | The default unit of the numbers that you're providing to the chart. | |
numberScaleUnit |
String | Unit of each block of the scale. | |
numberScaleValue |
String | Range of the various blocks that constitute the scale. | |
scaleRecursively |
Boolean | 0/1 | Whether recursive scaling should be applied. |
maxScaleRecursion |
Number | How many recursions to complete during recursive scaling? -1 completes the entire set of recursion. | |
scaleSeparator |
String | What character to use to separate the scales that are generated after recursion? | |
decimalSeparator |
String | This attribute helps you specify the character to be used as the decimal separator in a number. | |
thousandSeparator |
String | This attribute helps you specify the character to be used as the thousands separator in a number. | |
thousandSeparatorPosition |
Number | This option helps you specify the position of the thousand separator. | |
inDecimalSeparator |
String | In some countries, commas are used as decimal separators and dots as thousand separators. In XML/JSON, if you specify such values, it will give an error while converting to number. The chart accepts the input decimal and thousand separators from user, so that it can convert it accordingly into the required format. This attribute lets you input the decimal separators. | |
inThousandSeparator |
String | In some countries, commas are used as decimal separators and dots as thousand separators. In XML/JSON, if you specify such values, it will give an error while converting to number. The chart accepts the input decimal and thousand separators from user, so that it can convert it accordingly into the required format. This attribute lets you input the thousand separators. |
Data Plot Properties
These attributes let you customize the cosmetics of the data plots (the line segments and the anchors).
Name | Type | Range | Description |
---|---|---|---|
lineColor |
Color Code | Hex Code | Color using which the lines on the chart will be drawn. |
lineThickness |
Number | In pixels | Thickness of the lines on the chart. |
lineAlpha |
Number | 0-100 | Alpha of the lines on the chart. |
drawAnchors |
Boolean | 0/1 | Whether to draw anchors on the chart? If the anchors are not shown, then the tooltip and links won't work. |
anchorSides |
Number | This attribute sets the number of sides the anchor will have. For e.g., an anchor with 3 sides will represent a triangle, with 4 it will be a square and so on. | |
anchorRadius |
Number | In pixels | This attribute sets the radius (in pixels) of the anchor. |
anchorColor |
Color Code | Hex Code | Lets you set the color of anchors. |
anchorAlpha |
Number | 0-100 | Lets you set the alpha of anchors. |
Open, Close, High, and Low Properties
The spark line chart highlights the open, close, high, and low points and also shows their value. These attributes let you configure the chart to:
- Change color of open, close, high, low points
- Opt whether to highlight each one using anchors
- Whether to show values for each one of them
Name | Type | Range | Description |
---|---|---|---|
openColor |
Color Code | Hex Code | Color for opening value anchor. |
closeColor |
Color Code | Hex Code | Color for closing value anchor. |
highColor |
Color Code | Hex Code | Color for high value anchor. |
lowColor |
Color Code | Hex Code | Color for low value anchor. |
showOpenAnchor |
Boolean | 0/1 | Whether to show anchor for opening value? By default this attribute is set to 1. |
showCloseAnchor |
Boolean | 0/1 | Whether to show anchor for closing value? By default this attribute is set to 1. |
showHighAnchor |
Boolean | 0/1 | Whether to show anchor for high value? By default this attribute is set to 1. |
showLowAnchor |
Boolean | 0/1 | Whether to show anchor for low value? By default this attribute is set to 1. |
showOpenValue |
Boolean | 0/1 | Whether to show the opening value beside the chart? By default this attribute is set to 1. |
showCloseValue |
Boolean | 0/1 | Whether to show the closing value beside the chart? By default this attribute is set to 1. |
showHighLowValue |
Boolean | 0/1 | Whether to show the high/low value beside the chart? By default this attribute is set to 1. |
Period Block Properties
Period blocks are alternate colored bands that help to easily interpret periods on the chart.
These attributes let you customize the cosmetic properties for the period blocks.
Name | Type | Range | Description |
---|---|---|---|
periodLength |
Number | How many data points will each period block encapsulate? | |
periodColor |
Color Code | Hex Code | Color for the period block. |
periodAlpha |
Number | 0-100 | Alpha for the period block. |
Chart Cosmetics
These attributes let you customize chart cosmetics like the background color, background alpha, canvas color, canvas alpha etc.
Name | Type | Range | Description |
---|---|---|---|
bgColor |
Color Code | Hex Code | This attribute sets the background color for the chart. You can set any hex color code as the value of this attribute. To specify a gradient as background color, separate the hex color codes of each color in the gradient using comma. Example: `#FF5904, #FFFFFF`. |
bgAlpha |
Number | 0-100 | Sets the alpha (transparency) for the background. If you've opted for gradient background, you need to set a list of alpha(s) separated by comma. |
bgRatio |
Numbers separated by comma | If you've opted for a gradient background, this attribute lets you set the ratio of each color constituent. | |
bgAngle |
Number | 0-360 | Angle of the background color, in case of a gradient. |
showBorder |
Boolean | 0/1 | Whether to show a border around the chart or not? |
borderColor |
Color Code | Hex Code | Border color of the chart. |
borderThickness |
Number | In pixels | Border thickness of the chart. |
borderAlpha |
Number | 0-100 | Border alpha of the chart. |
bgImage |
String | To place any image (JPG/PNG/GIF) as background of the chart, enter the (path and) name of the background image. It should be in the same domain as the chart. | |
bgImageAlpha |
Number | 0-100 | This attribute specifies the opacity for the loaded background image. |
bgImageDisplayMode Since 3.2 |
String | 'stretch', 'tile', 'fit', 'fill', 'center', 'none' | Helps you specify the mode in which the background image is to be displayed. Stretch - expands the image to fit the entire chart area, without maintaining original image constraints. Tile - the image is repeated as a pattern on the entire chart area. Fit - fits the image proportionately on the chart area. Fill -proportionately fills the entire chart area with the image. Center - the image is positioned at the center of the chart area. None - Default mode. |
bgImageVAlign Since 3.2 |
String | 'top', 'middle', 'bottom' | Helps you to vertically align the background image. |
bgImageHAlign Since 3.2 |
String | 'left', 'middle', 'right' | Helps you to horizontally align the background image. |
bgImageScale Since 3.2 |
Number | 0-300 | Helps you magnify the background image. This attribute will only work when the attribute `bgImageDisplayMode` is set to none, center, or tile. |
logoURL |
String | You can load an external logo (JPEG/PNG) to your chart, this attribute lets you specify the URL. Due to cross domain security restrictions it is advised to use a logo from the same domain name as your charts. | |
logoPosition |
String | 'TL', 'TR', 'BL', 'BR', 'CC' | Where to position the logo on the chart: TL - Top-left TR - Top-right BR - Bottom right BL - Bottom left CC - Center of screen |
logoAlpha |
Number | 0-100 | Once the logo has loaded on the chart, you can configure its opacity using this attribute. |
logoScale |
Number | 0-100 | You can also change the size of externally loaded logo at run-time by specifying a value for this parameter. |
logoLink |
String | If you want to link the logo to an external URL, specify the link in this attribute. The link can be in FusionCharts link format, allowing you to link to new windows, pop-ups, frames etc. |
Font Properties
These attributes let you define the generic font properties for all the text on the chart, allowing you a high level control over font properties.
Name | Type | Range | Description |
---|---|---|---|
baseFont |
Font Name | This attribute lets you set the font face (family) of all the text (data labels, values etc.) on chart. If you specify outCnvBaseFont attribute also, then this attribute controls only the font face of text within the chart canvas bounds. | |
baseFontSize |
Number | This attribute sets the base font size of the chart i.e., all the values and the names in the chart which lie on the canvas will be displayed using the font size provided here. | |
baseFontColor |
Color Code | Hex Code | This attribute sets the base font color of the chart i.e., all the values and the names in the chart which lie on the canvas will be displayed using the font color provided here. |
Tool-tip Properties
These attributes let you configure the functional and cosmetic properties of tool-tips.
Name | Type | Range | Description |
---|---|---|---|
showToolTip |
Boolean | 0/1 | Whether to show tooltip for the annotations? |
toolTipBgColor |
Color Code | Hex Code | Background color for the tooltip |
toolTipColor |
Color Code | Hex Code | Font color for the tool-tip. |
toolTipBorderColor |
Color Code | Hex Code | Border Color for the tooltip. |
showToolTipShadow |
Boolean | 0/1 | Whether to show shadow for tooltips. |
Chart Paddings and Margins
FusionWidgets XT allows you to manually customize the padding of various elements on the chart to allow advanced manipulation and control over chart visualization. Padding in FusionWidgets XT is always defined in pixels, unless the attribute itself suggests some other scale (like plotSpacePercent
).
You can also define the chart margins. Chart margins refer to the empty space left on the top, bottom, left, and right of the chart. That means, FusionWidgets XT will not plot anything in that space.
It is not necessary for you to specify any padding/margin values. FusionWidgets XT automatically assumes the best values for the same.
These attributes let you configure the functional and cosmetic properties of chart paddings and margins.
Name | Type | Range | Description |
---|---|---|---|
captionPadding |
Number | In pixels | This attribute lets you control the horizontal space (in pixels) between the caption and left side of chart canvas. |
valuePadding |
Number | In pixels | This attribute lets you control the horizontal space between value textboxes and chart. |
chartLeftMargin |
Number | In pixels | Amount of empty space that you want to put on the left side of your chart. Nothing is rendered in this space. |
chartRightMargin |
Number | In pixels | Amount of empty space that you want to put on the right side of your chart. Nothing is rendered in this space. |
chartTopMargin |
Number | In pixels | Amount of empty space that you want to put on the top of your chart. Nothing is rendered in this space. |
chartBottomMargin |
Number | In pixels | Amount of empty space that you want to put at the bottom of your chart. Nothing is rendered in this space. |
canvasLeftMargin |
Number | In pixels | Left margin of canvas. Canvas will start from that position. |
canvasRightMargin |
Number | In pixels | Right margin of canvas. Canvas will end at that position. |
Trend-lines
Using the <trendlines> element (and the children <line> elements), you can define trend lines on the chart.
Trend lines are horizontal lines spanning the chart canvas which aid in interpretation of data with respect to some pre-determined value. For example, if you are plotting sales data of current year, you might want to add previous year's average monthly sales as trend indicator for ease of comparison.
Use the code snippet shown below to render a horizontal trend-line on the chart:
... "chart": { ... }; "trendlines": [{ "line": [{ "startvalue": "177500", "color": "#00cc00", "displayvalue": "Target" }] }] ...
These attributes let you customize the functional and cosmetic properties for trend-lines.
Name | Type | Range | Description |
---|---|---|---|
startValue |
Number | The starting value for the trendline. Say, if you want to plot a slanted trendline from value 102 to 109, the `startValue` will be 102. | |
endValue |
Number | The ending y-axis value for the trendline. Say, if you want to plot a slanted trendline from value 102 to 109, the `endValue` will be 109. If you do not specify a value for `endValue`, it will automatically assume the same value as `startValue`. | |
color |
Color Code | Hex Code | Color of the trend line and its associated text |
thickness |
Number | In pixels | If you've opted to show the trend as a line, this attribute lets you define the thickness of trend line. |
isTrendZone |
Boolean | 0/1 | Whether the trend will be displayed as a line or a zone (fill-colored rectangle). |
alpha |
Number | Alpha of the trend line. | |
dashed |
Boolean | 0/1 | If you've opted to show the trend as a line, this attribute lets you define whether the trend line will appear as dashed? |
dashLen |
Number | In pixels | If you've opted to show trend line as dash, this attribute lets you control the length of each dash. |
dashGap |
Number | In pixels | If you've opted to show trend line as dash, this attribute lets you control the length of each dash gap. |
showOnTop |
Boolean | 0/1 | By default, the trendline/trendzone appears below the dataplots. This attribute allows you to display the trendline/trendzone on top of the dataplots. |