5

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?

1
  • Highcharts-ng does not require jquery. Just use Highcharts standalone framework Commented Feb 15, 2014 at 19:08

2 Answers 2

7

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Had missed that they had release a stand alone version. Truly perfect for angular. 32k is saved when I don't need Jquery. Thx for the help and demo provided!
You can even make that chart dragable: plnkr.co/edit/oTLE11tQIHvpQieGYGGu?p=preview
How can i redraw the chart using this method? It doesn't get updated when the values change.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.