frappe / charts

Simple, responsive, modern SVG Charts with zero dependencies
https://frappe.io/charts
MIT License
14.94k stars 718 forks source link

Uncaught TypeError after update to v1.0.0 #131

Closed ghost closed 6 years ago

ghost commented 6 years ago

Expected Behaviour

After updating to version 1.0.0 everything should work as before.

Actual Behaviour

I replaced frappe-charts.min.iife.js in my web application and none of the charts will be rendered. The following error can be found in the console. Tested with Chrome and Firefox (latest stable versions).

chart.js:38 Uncaught TypeError: Cannot read property 'type' of undefined
    at new t (chart.js:38)

Steps to Reproduce:

Use the following code with version 1.0.0 of this library.

<script src="/static/js/frappe-charts.min.iife.js"></script>
<div class="w3-container w3-padding">
    <div id="chart-price-usd"></div>
    <script>
    new Chart({
        parent: '#chart-price-usd',
        data: {"labels":["Feb 27","Feb 28","Mar 1","Mar 2","Mar 3","Mar 4","Mar 5","Mar 6","Mar 7","Mar 8"],"datasets":[{"title":"","values":[0.07903474305555558,0.07528269444444448,0.07148536027874566,0.07120552543554012,0.07250097708333338,0.07222700278745649,0.07639610416666669,0.06865092402826857,0.061025230313588884,0.05543630701754389]}]},
        type: 'line',
        title: 'Last 10 days: Average price in USD',
        colors: ['blue'],
        height: 250,
        format_tooltip_y: d => {
            if (d < 0.1) {
                return '$' + d.toFixed(4)
            }
            return '$' + d.toFixed(2)
        }
    });
    </script>
</div>

Frappé Charts version: 1.0.0

pratu16x7 commented 6 years ago

v1.0.0 has an API change. Please follow up on #132. Thanks.