score:2

Accepted answer

it doesn't matter that you have categories on the x axis, as far as the scatter plot is concerned - your x values are the array index of the categories (0-5 in the case of your image).

there is a plugin to auto calculate a regression line, here:

or, you can calculate your own and plot it normally.

however, a regression line through a group of categories doesn't make much sense. i don't see how it can tell you anything useful, and is probably more likely to cause confusion or outright misunderstanding.

this seems to me to be data that would be more appropriate to plot with a bar chart than a scatter plot.

fwiw

{{edit:

after looking at this longer, i am somewhat unclear: is that actually a regression line, or is that an average, or a target...?

if that's the case, you can either plot it is a line series, or you can use plotlines:

example with a plotline:

score:2

the chart like this is very easily done using amcharts regular serial chart with line graph with bullets (bullet: "diamond") and no line (linealpha: 0).

var chart = amcharts.makechart( "chartdiv", {
  "type": "serial",
  "dataprovider": [ {
    "category": "civil",
    "value": 0.87
  }, {
    "category": "piping",
    "value": 1.1
  }, {
    "category": "mechanical",
    "value": 0.69
  }, {
    "category": "electrical",
    "value": 0.82
  }, {
    "category": "insulation",
    "value": 1.42
  }, {
    "category": "completion",
    "value": 1.1
  } ],
  "valueaxes": [ {
    "guides": [{
      "value": 1,
      "linealpha": 1,
      "linethickness": 2,
      "linecolor": "#f00"
    }]
  } ],
  "startduration": 1,
  "graphs": [ {
    "linealpha": 0,
    "bullet": "diamond",
    "valuefield": "value",
    "linecolor": "#5782bf"
  } ],
  "chartcursor": {
    "categoryballoonenabled": false,
    "cursoralpha": 0,
    "zoomable": false
  },
  "categoryfield": "category",
  "categoryaxis": {
    "gridposition": "start",
    "gridalpha": 0,
    "tickposition": "start"
  }

} );
<script src="http://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="http://www.amcharts.com/lib/3/serial.js"></script>
<div id="chartdiv" style="width: 600px; height: 200px;"></div>


Related Query

More Query from same tag