Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8749071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:38:00+00:00 2026-06-13T12:38:00+00:00

I am new to Angular and Flot, but am experienced with Jquery and Javascript.

  • 0

I am new to Angular and Flot, but am experienced with Jquery and Javascript. I am a bit confused about how to go about binding a Flot chart to Angular data models, since Flot is a JQuery plugin. I’ve searched around, but haven’t been able to find an example.

I would also be happy to use highcharts, google-charts, or any other charting solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:38:01+00:00Added an answer on June 13, 2026 at 12:38 pm

    Since charting involves heavy DOM manipulation, directives are the way to go.

    Data can be kept in the Controller

    App.controller('Ctrl', function($scope) {
        $scope.data = [[[0, 1], [1, 5], [2, 2]]];
    });
    

    And you can create a custom HTML tag1 specifying the model you want to get data from

     <chart ng-model='data'></chart>
    

    which angular can compile through a directive

    App.directive('chart', function() {
        return {
            restrict: 'E',
            link: function(scope, elem, attrs) {
                var data = scope[attrs.ngModel];
                $.plot(elem, data, {});
                elem.show();
            }
        };
    });
    

    Example here.

    This process is similar for most plugins that modify the DOM.

    -*-

    Also, you can watch for changes in the chart’s underlying data and redraw it, so this way you can grab data through the $http service from your controller and update the view automatically. This can be achieved by modifying the linking function in the directive definition object

       var chart = null,
           opts  = { };
    
        scope.$watch(attrs.ngModel, function(v){
            if(!chart){
                chart = $.plot(elem, v , opts);
                elem.show();
            }else{
                chart.setData(v);
                chart.setupGrid();
                chart.draw();
            }
        });
    

    Notice the usage of Flot’s API within the directive to achieve what we want.

    Here the full example


    1 Can be an attribute too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New question, but really close to need to refresh page in jquery mobile .
New to javascript/jquery and having a hard time with using this or $(this) to
New to SO and javascript. I have been playing with JQuery for a couple
New to Scala, but experienced in C++ I'm trying to implement (possibly misguidedly) a
I'm new to Angular and still learning. I read alot about generating static HTML
New to PHP and MySQL, have heard amazing things about this website from Leo
new here and new to jQuery. I've searched for an answer to my question/
New developer here,Im using the Custom Image Picker by ray wenderlich. But what I
I am new to angular, I want to know if angularjs supports nested routes
New to MonoTouch and MonoTouch.Dialog, but I'm sure it's possible to create a tab

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.