JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://demo.randomcoding.com/min-trade/js/flot/jquery.flot.min.js"></script>
<div id='graph1'>data</div>
<button type='button' id='btn'>Clicksdfsdf</button>

JavaScript

$(function () {
    $("#btn").click(function () {
        var data = fetchData();
        data    = eval("(" + data + ")");
         $.plot($("#graph1"), data, {
            pie: {
                show: true,
                showLabel: true
            },
            legend: {
                show: false
            }
        });
    });

    function fetchData() {
       return '[{"item":"Final 2010","COUNT(target)":"2"},{"item":"Semi Final 2009","COUNT(target)":"3"}]';
    }
});