Joe
Joe

Reputation: 4234

Highcharts in AngularJs without jQuery?

Is there any directive for highcharts where you don't need the full jQuery? This ones seem's the most popular at the moment but I can't get it work without jQuery: https://github.com/pablojim/highcharts-ng

Is it possible to write a highcharts directive and only using the light version of jQuery that is included with angular?

If I do have to include the full jQuery, will it affect the loading time/performance of my app signifigantly?

Upvotes: 5

Views: 2619

Answers (2)

allenhwkim
allenhwkim

Reputation: 27738

It's not hard to build a directive that wraps the existing javascript library.

This is code for a highchart directive. It's very simple.

app.directive("highcharts", function() {
  return {
    link: function(scope, el, attrs) {
      var options = scope.$eval(attrs.highcharts);
      options.chart.renderTo = el[0];
      new Highcharts.Chart(options);
    }
  };
})

Full demo is here. http://plnkr.co/edit/iN8TAMKyHIyN4F44iJ0U?p=preview

My answer to you is, if you like https://github.com/pablojim/highcharts-ng

  • just add standalone-framework instead of full jQuery.

  • if not, like me :), build your own like the demo provided. it's not that hard.

BTW, This is the page Highcharts introduces their standalone framework.

Upvotes: 7

Pedro Justo
Pedro Justo

Reputation: 4289

highchart is great, but currently even the Standalone Framework for Highcharts comes bundled with a jQuery adapter that can't be removed, and this is not so good if your plan is develop a mobile app

Upvotes: 0

Related Questions