title: AmCharts 4 - How to use custom ajax response in MapPolygonSeries()
body: <p>I'm testing amcharts 4 map (PieChart() &amp; MapPolygonSeries()) and I have a response.data like this:</p>
  
  <pre><code>{
      "status": 200,
      "legal_country": [
          {
              "legal_country": "US",
              "count(*)": 171576
          },
          {
              "legal_country": "GB",
              "count(*)": 130246
          },
          {
              "legal_country": "DE",
              "count(*)": 112459
          },
          {
              "legal_country": "NL",
              "count(*)": 96554
          }
      ]
  }   
  </code></pre>
  
  <p>I store the legal_country array in two variables:</p>
  
  <pre><code>var getAjaxRecords1 = data.legal_country;
  var getAjaxRecords2 = data.legal_country;   
  </code></pre>
  
  <p>Now for the am4charts.PieSeries() I can access the data and define value and category like this:</p>
  
  <pre><code>var chart = am4core.create("lei_pie", am4charts.PieChart);
  
  chart.data = getAjaxRecords2;   
  
  var series = chart.series.push(new am4charts.PieSeries());
  series.dataFields.value = "count(*)";
  series.dataFields.category = "legal_country";   
  </code></pre>
  
  <p>All works fine. </p>
  
  <p>But how can use the data in the MapPolygonSeries()? This does not work: </p>
  
  <pre><code>// Create polygon series
  var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
  polygonSeries.useGeodata = true;
  ...
  polygonSeries.dataFields.value = "count(*)";
  polygonSeries.dataFields.category = "legal_country";
  
  polygonSeries.data = getAjaxRecords1;   
  </code></pre>
  
  <p>... and I don't find it in the docs: <a href="https://www.amcharts.com/docs/v4/reference/mappolygonseries/" rel="nofollow noreferrer">https://www.amcharts.com/docs/v4/reference/mappolygonseries/</a></p>