amCharts v4: Legend match Column Color

fork of https://jsfiddle.net/bosiljkakostic1/de16nbu7/4/

by notacouch

HTML

<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<div id="chartdiv"></div>

CSS

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

#chartdiv {
  width: 100%;
  height: 300px;
}

JavaScript

/* 
fork of:
https://jsfiddle.net/bosiljkakostic1/de16nbu7/4/

answering:
https://stackoverflow.com/questions/55097474/legend-do-not-follow-colors-of-series-when-it-is-set-by-series-columns-template
*/

/**
 * ---------------------------------------
 * This demo was created using amCharts 4.
 *
 * For more information visit:
 * https://www.amcharts.com/
 *
 * Documentation is available at:
 * https://www.amcharts.com/docs/v4/
 * ---------------------------------------
 * MODIFIED by Bosiljka Kosic, adding legend
 * and more series to describe the problem :
 * legend does not follow colors of series 
 * when it is set by  
 * series.columns.template.propertyFields.fill
 * as when it is with series.fill
 */

// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);

// Add data
chart.data = [{
  "category": "Research & Development",
  "value1": 450,
  "color1": "red",
  "value2": 1200,
  "color2": "blue",
  "value3": 1500,
  "color3": "green"
},
{
  "category": "Marketing",
  "value1": 700,
  "color1": "red",
  "value2": 1000,
  "color2": "blue",
  "value3": 1200,
  "color3": "green"
},
{
  "category": "Distribution",
  "value1": 600,
  "color1": "red",
  "value2": 400,
  "color2": "blue",
  "value3": 1100,
  "color3": "green"
}              
             ];

// Create axes
var categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
categoryAxis.renderer.grid.template.location = 0;

var valueAxis = chart.yAxes.push(new am4charts.ValueAxis());

// Create series
var series1 = chart.series.push(new am4charts.ColumnSeries());
series1.dataFields.valueY = "value1";
series1.dataFields.categoryX = "category";
series1.columns.template.propertyFields.fill = "color1";
var series2 = chart.series.push(new am4charts.ColumnSeries());
series2.dataFields.valueY = "value2";
series2.dataFields.categoryX = "category";
series2.columns.template.propertyFields.stroke = "color2";
var series3 =...