MaazAli / Meteor-HighCharts

HighCharts for Meteor, with an easy to use helper to get you started!
MIT License
53 stars 20 forks source link

Running App gives error #16

Closed steinitz-zz closed 9 years ago

steinitz-zz commented 9 years ago

Hi,

This project looks interesting.

When I build and run in WebStorm I get this error

Uncaught TypeError: Cannot set property 'topGenresChart' of undefined (anonymous function)
(anonymous function)
Exception from Tracker afterFlush function: TypeError: Cannot read property 'chart' of null at win.HighchartsAdapter.win.HighchartsAdapter.$.init.$.fn.highcharts (http://localhost:3000/packages/maazalik_highcharts.js?63886d2fa45cba023ed261d763e5628418c655fb:1021:30) at Template.highchartsHelper.rendered (http://localhost:3000/packages/maazalik_highcharts.js?63886d2fa45cba023ed261d763e5628418c655fb:21473:29) at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3155:22 at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3476:12) at fireCallbacks (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3151:12) at null. (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:3244:5) at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1778:14 at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:2197:12) at http://localhost:3000/packages/blaze.js?a5c324925e5f6e800a4c618d71caf2848b53bf51:1777:15 at Object.Tracker._runFlush (http://localhost:3000/packages/tracker.js?6d0890939291d9780f7e2607ee3af3e7f98a3d9c:501:11)

I get the same error when I build and run jhuenges highcharts-demo project.

I hope this report is useful.

Cheers,

Steve

MaazAli commented 9 years ago

The readme example is kind of outdated. Use this instead

Template.myTemplate.helpers({
  topGenresChart: function() {
    return {
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        title: {
            text: this.username + "'s top genres"
        },
        tooltip: {
            pointFormat: '<b>{point.percentage:.1f}%</b>'
        },
        plotOptions: {
            pie: {
                allowPointSelect: true,
                cursor: 'pointer',
                dataLabels: {
                    enabled: true,
                    format: '<b>{point.name}</b>: {point.percentage:.1f} %',
                    style: {
                        color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
                    },
                    connectorColor: 'silver'
                }
            }
        },
        series: [{
            type: 'pie',
            name: 'genre',
            data: [
                ['Adventure',   45.0],
                ['Action',       26.8],
                ['Ecchi',   12.8],
                ['Comedy',    8.5],
                ['Yuri',     6.2]
            ]
        }]
    };
  }
});
steinitz-zz commented 9 years ago

Hi,

Thanks for your reply. I've fussed for 30 minutes but can't get the code to build in meteor. WebStorm gives a silly "unexpected ;" error which I can't seem to solve. (I'm not yet a javascript expert - the more I try to fix it the worse it gets :) ) I've added the package maazalik:highcharts.

I'll probably figure it out eventually. I just wanted to reply and thank you.

Cheers,

Steve

On 14 Apr 15, at 1:00am, Maaz Ali notifications@github.com wrote:

The readme example is kind of outdated. Use this instead

Template.myTemplate.helpers({ topGenresChart: function() { return { chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: this.username + "'s top genres" }, tooltip: { pointFormat: '{point.percentage:.1f}%' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '{point.name}: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' }, connectorColor: 'silver' } } }, series: [{ type: 'pie', name: 'genre', data: [ ['Adventure', 45.0], ['Action', 26.8], ['Ecchi', 12.8], ['Comedy', 8.5], ['Yuri', 6.2] ] }] }; }; });

— Reply to this email directly or view it on GitHub.

steinitz-zz commented 9 years ago

Hi again Maaz Ali

I just wanted you to know that your meteor example site builds perfectly in WebStorm so I can use that as a starting point. I'll be presenting HighCharts as a solution to a new client this afternoon.

Thanks again for your help.

Cheers,

Steve

MaazAli commented 9 years ago

That's great, you can use the example site as your demos. I'll update the readme with the more up to date code.