FusionCharts - Adding Trendlines in Sparkline chart

Created using FusionCharts Suite XT - www.fusioncharts.com

by FusionCharts

HTML

<script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<!-- Adding Trendlines in SparkLine chart using:
    
    Element
    # trendlines

    Attribute
        # startValue - The starting value for the trendline. To plot a slanted trendline from value 102 to 109, the startValue will be 102.
        # endValue - The starting value for the trendline. To plot a slanted trendline from value 102 to 109, the endValue will be 109.
    
-->
<div id="chart-container">FusionCharts will render here</div>

JavaScript

FusionCharts.ready(function() {
  var stockPriceChart = new FusionCharts({
      type: 'sparkline',
      renderAt: 'chart-container',
      width: '450',
      height: '70',
      dataFormat: 'json',
      dataSource: {
        "chart": {
          "theme": "fusion",
          "caption": "Stock Price",
          "subcaption": "Last month",
          "numberPrefix": "$",
          "chartBottomMargin": "30"
        },
        "dataset": [{
          "data": [{
              "value": "38.42"
            },
            {
              "value": "41.43"
            },
            {
              "value": "34.78"
            },
            {
              "value": "40.67"
            },
            {
              "value": "44.12"
            },
            {
              "value": "38.45"
            },
            {
              "value": "40.71"
            },
            {
              "value": "49.90"
            },
            {
              "value": "40.12"
            },
            {
              "value": "34.91"
            },
            {
              "value": "42.02"
            },
            {
              "value": "35.21"
            },
            {
              "value": "43.31"
            },
            {
              "value": "40.21"
            },
            {
              "value": "40.54"
            },
            {
              "value": "40.90"
            },
            {
              "value": "54.21"
            },
            {
              "value": "41.90"
            },
            {
              "value": "33.43"
            },
            {
              "value": "46.73"
            },
            {
              "value": "50.42"
            },
            {
              "value": "40.74"
            },
            {
              "value": "42.31"
            },
            {
              "value": "50.39"
            },
            {
              "value": "51.10"
            },
            {
              "value": "44.84"
  ...