FusionCharts - Scatter Chart with regression line

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>
<!-- Scatter chart or XY plot chart with regession line. This sample shows how temperature affects the sales revenue of Beer and Ice Cream. Attribute: # showRegressionLine for <dataset> node.
-->
<div id="chart-container">FusionCharts will render here</div>

JavaScript

FusionCharts.ready(function() {
  var tempVsSalesChart = new FusionCharts({
    type: 'scatter',
    renderAt: 'chart-container',
    width: '650',
    height: '350',
    dataFormat: 'json',
    dataSource: {
      "chart": {
        "caption": "Sales of Beer & Ice-cream vs Temperature",
        "subcaption": "Los Angeles Topanga",
        "xaxisname": "Average Day Temperature",
        "yaxisname": "Sales (In USD)",
        "xaxisminvalue": "23",
        "xaxismaxvalue": "95",
        "ynumberprefix": "$",
        "xnumbersuffix": "&deg; F",
        "theme": "fusion"
      },
      "categories": [{
        "category": [{
          "x": "23",
          "label": "23\xB0 F",
          "showverticalline": "0"
        }, {
          "x": "32",
          "label": "32\xB0 F",
          "showverticalline": "1"
        }, {
          "x": "50",
          "label": "50\xB0 F",
          "showverticalline": "1"
        }, {
          "x": "68",
          "label": "68\xB0 F",
          "showverticalline": "1"
        }, {
          "x": "80",
          "label": "80\xB0 F",
          "showverticalline": "1"
        }, {
          "x": "95",
          "label": "95\xB0 F",
          "showverticalline": "1"
        }]
      }],
      "dataset": [{
        "seriesname": "Ice Cream",
        "showregressionline": "1",
        "data": [{
            "x": "23",
            "y": "1560"
          },
          {
            "x": "24",
            "y": "1500"
          },
          {
            "x": "24",
            "y": "1680"
          },
          {
            "x": "25",
            "y": "1780"
          },
          {
            "x": "25",
            "y": "1620"
          },
          {
            "x": "26",
            "y": "1810"
          },
          {
            "x": "27",
            "y": "2310"
          },
          {
            "x": "29",
            "y": "2620"
          },
          {
            "x": "31",
            "y": "2500"
          },
          {
        ...