GithubHelp home page GithubHelp logo

grafiddle / angular-chart Goto Github PK

View Code? Open in Web Editor NEW
127.0 127.0 39.0 1.63 MB

AngularJS directive for adjustable dynamically updating c3 charts

Home Page: http://grafiddle.github.io/angular-chart/

License: MIT License

JavaScript 97.09% HTML 2.91%

angular-chart's Introduction

graFiddle

Share and collaborate on visualizations using graFiddle.it

Setup

  • $ npm install
  • $ bower install
  • $ sudo gem install compass
  • Create project on Google App Engine and setup your machine for deployment

Build

  • $ gulp build

Deploy

  • $ cd server
  • $ appcfg.py -A grafiddle update app

angular-chart's People

Contributors

johanlorenzo avatar lbayerl avatar luisescobedo avatar maxklenk avatar mfollett avatar myagoo avatar phisherman avatar sebastianhenneberg avatar terryjohnson-dowjones avatar ulilicht avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-chart's Issues

How do I use grouping to do a stacked bar?

It's not clear to me how to use the grouping feature of the API. The documentation points towards the C3 example, but that uses the columns field as the data orientation, whereas angular-chart doesn't seem to support the columns field, but it is still possible to specify orientation. The two APIs seem to be slightly different in this case, and I've not been able to get grouping working in angular-chart.

It would be really helpful to see a grouping, stacked-bar example of the angular-chart API, and how the orientation property works. Aside from this, I've been impressed with angular-chart and found it useful and easy use and integrate.

many thanks in advance

Usage of scope.apply() on onselect()

Hi,

I'm not completely sure about this, but as far as I understand we have to call scope.apply() before executing functions like onselect.

My Problem: I'm triggering some scope variable change with onSelect and it is not applied. When i change
https://github.com/maxklenk/angular-chart/blob/master/src/chart.js#L616

if (scope.options.selection.onselected) {
      scope.options.selection.onselected();
}

to

 if (scope.options.selection.onselected) {
       scope.$apply(function(){
           scope.options.selection.onselected();
       });
 }

It works.

Is is a problem in my application code or in the directive?

Add zoom to canvas

To explore the data it should be possible to zoom in the data in the xAxis.

fix dataset watchers for promises or other objects

I have set dataset properly in my controller but in the directive 'angularchart' scope has dataset,options etc are coming undefined.
Dataset is accessible in ng-repeat function in the same view.

My controller:

var SearchAppController = angular.module('SearchAppController', ['angularChart']);

SearchAppController.controller('ItemDetailController',function($scope,$http,$location,$routeParams){

    var itemID = $routeParams.itemID;
    var completeURL = "/search/price/"+itemID;
    var responsePromise = $http.get(completeURL);
    responsePromise.success(function(data, status, headers, config) {
        var historyList = data[0].history;
        $scope.dataset = historyList;
                        $scope.schema = {
                          time: {
                            type: 'datetime',
                            format: '%Y-%m-%d %H:%M:%S',
                            name: 'Date'
                          }
                        };

                        $scope.options = {
                          rows: [{
                            key: 'lowestNewPrice',
                            type: 'bar'
                          }, {
                            key: 'time'
                          }],
                          xAxis: {
                            key: 'time',
                            displayFormat: '%Y-%m-%d %H:%M:%S'
                          }
                        };


});

});

My view:

Thanks in advance!

Synchronizing "options" property

Hi Max,

I tried your directive - but got some trouble when trying to dynamically modify the selections of a graph.

When selecting any point, it is added to the selections object of options. (sync c3 --> angular) but when I try to modify those selections in angular, they are not synced back. (e.g. removing an entry in the selections array)

I for example would expect this code to remove one element:

$scope.$watch('options.selection.selected', function (newVal, oldVal) {
      if (newVal.length > 2) {
        console.log('more than two values selected', $scope.options.selection.selected);
        $scope.options.selection.selected.shift(); 
       console.log('more than two values selected', $scope.options.selection.selected);
      }
    }, true);

Is there yet any possibility to achieve this?

Padding is not implemented

Hello Max--first of all, thanks for the awesome project! Secondly, I noticed padding didn't seem to be implemented and the only way I could figure a way around it was to implement it like so:

// Padding
//
if (scope.options.padding) {
  scope.configuration.padding = scope.options.padding;
} else {
  scope.configuration.padding = {};
}

Which seemed to work simply enough when I specified padding in my options like so:

$scope.options = {
  padding: {
    bottom: 20
  }
};

Misplaced Tooltip

In the screenshot below, I hover on bottom right chart, however, the tooltip shown at the top left

screen shot 2015-04-06 at 3 40 03 pm

I fixed it by giving angularchart directive a position: relative style.

Shouldn't angularchart directive have position: relative style by default?

yAxis min/max options does not work

Here's an example options input:

    $scope.options = {
      rows: [{
        key: 'one',
        type: 'bar'
      }, {
        key: 'two',
        type: 'bar'
      }, {
        key: 'three',
        type: 'bar'
      }],
      xAxis: {
        key: 'atTime',
        displayFormat: '%Y-%m-%d %H:%M:%S'
      },
      yAxis: {
        max: 400,
        min: -400,
        label: "Number of contributions"
      }
    }

everything works correctly except min / max.

The docs also state that the value for yAxis' min/max is a string. Shouldn't those be number?

Commented out $watch for dataset ?

Change c4edf65 commented out lines 695-697 in angular-chart.js which means that there's no watcher for the dataset.

Was this an error ?

In my testing the lack of watcher means that if I update the dataset after fetching data the chart is not updated. Restoring the $watch fixes this - but am I missing an alternative or better way to update the chart?

Edit Rows

Add options to edit which and how rows are displayed in the visualization.

ToDo:

  • add optional enable row edit flag
  • add custom legend
  • add option to hide/show (remove/add?) rows
  • add function to hide/show (remove/add?) rows
  • add function to change row display (line,bar,area,scatter) 'only for multi chart'
  • add option to change the color of a row
  • add function to change the color of a row
  • add hover highlighting for rows
  • add option to align row to y2-Axis
  • add function to change y-Axis

Can't create chart from within another Directive as throws "No Data Provided"

I'm trying to use the chart from within another directive. In this directive the scope where I set the data is created in local scope of my directive's link function. However the link function for the chart has already ran and thrown a fail on this line:

https://github.com/maxklenk/angular-chart/blob/develop/src/chart.js#L120

The watcher's are then never set after this is thrown in the rest of the link function below. The chart data is determined from within my directive so it appears I'm stuck? Am I missing something or how do I deal with this before I fork the project? I've never had a similar issue with other directives.

Do not expose dataAttributeChartID in options

The attribute dataAttributeChartID in the options of the directive is just for internal use (C3 requires it to refer the DOM nodes). Generate the ID inside of the directive. Do not expose it to the outside world.

Tooltip is displayed far too below when using <angularchart> as an element

When you angularchart like this sample:

<angularchart dataset="chartData" options="chartOptions"></angularchart>

and you put you mouse on a data point, the tooltip is displayed at least 200px below the cursor. This doesn't happen when you use:

<div angularchart dataset="chartData" options="chartOptions"></div>

Hence, the problem is that <angularchart> acts like a span instead of a <div> used by c3.js.

Chart not rendering on IE 8/7

I have added angularJS1.2.28 instead of angularJS 1.3.x. Chart is working fine till IE 9 but It is not support for IE 8/7. Is there any pollyfill for supporting chart on IE 8/7?

Agenda for angular-chart 0.3.0

Version 0.3.0 will contain some structural changes to separate functions and to be able to keep up with the development of c3.js.

Tasks

  • adjust angular-chart options to c3.js configuration to allow an easier transition from c3.js to angular-chart
  • find a way to set/update all simple c3.js configuration parameters at once (#53, #54)
  • define how the schema object sets config parameters (set postfix, displayFormat, ...)
  • extract in-place editor features from core file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.