cdjackson / angular-dygraphs Goto Github PK
View Code? Open in Web Editor NEWAngularJS directive for dygraphs
Home Page: http://cdjackson.github.io/angular-dygraphs/
License: MIT License
AngularJS directive for dygraphs
Home Page: http://cdjackson.github.io/angular-dygraphs/
License: MIT License
I need all my dygraphs start at 0. And for that I tried to add to graph options and nothing happen.. my graphs still show negative values... I tried to add to my directive and doenst work either. What can i do?
Directive:
(function() {
var app = angular.module('dashboard.view', []);
app.directive('dygraph', function(){
return {
restrict: 'E',
scope: {
data : '=',
options : '=?'
},
template: '<div style="width: 100%"></div>',
link: function (scope, elem, attrs) {
var div = elem.children()[0];
scope.options.width = elem.parent()[0];
scope.options.axes.y.includeZero = true;
var graph = new Dygraph(div, scope.data, scope.options);
}
};
});
})();
Graph Options:
var options = {
labels: labels,
showRangeSelector: true,
legend: 'always',
ylabel: units,
title: graphTitle,
includeZero: true,
axes: {
y: {
valueFormatter: function (value, opts, seriesName, dygraph, row, col) {
if (seriesName == "Sysmode") {
return modemSysmode[value];
} else if (seriesName == "Roaming") {
return modemRoaming[value];
}
return value;
},
includeZero: true
}
},
underlayCallback: function(canvas, area, g) {
for (var i=0; i<highlightArea.length; i++) {
var left = g.toDomXCoord(highlightArea[i][0]);
var right = g.toDomXCoord(highlightArea[i][1]);
canvas.fillStyle = "rgba(217, 101, 87, 0.2)";
canvas.fillRect(left, area.y, right - left, area.h);
}
}
}
If I debug my options the value includeZero appears with true.
Currently there's no watch for the options, meaning that changing them won't update the graph. I added the code in my local copy and doing a pull request
Hello
How can I resize the graph when the parent resizes?
The source has calls to console.log scattered throughout which is nice for development but not for production.
Has this directive been tested against angular 1.3? I am getting a race condition on 1.3 with the "resize()" function.
Hi Chris,
I'd like to know if there's a way to add annotations in angular-dygraphs.
I'm currently looking in the plugin directory and see "annotations.js".
If you know how to deal with annotations, any help would be appreciated as I really need this feature :/
Thanks in advance.
I'm having troubles showing a graph wyth dygrpah. I can have the options and data of the graph
options: {"labels":["date","live","repeated","passerBy"],"showRangeSelector":true,"title":"Scanning","axes":{"y":{}},"width":0}
data:
[["2017-07-17T10:12:00.000Z","408","396","351"],["2017-07-17T10:17:00.000Z","440","588","582"],["2017-07-17T10:22:01.000Z","410","580","529"],["2017-07-17T10:27:01.000Z","550","578","508"],["2017-07-17T10:37:00.000Z","532","501","544"],["2017-07-17T10:42:00.000Z","528","573","554"],["2017-07-17T10:47:00.000Z","313","376","409"],["2017-07-17T10:48:00.000Z","134","82","69"],["2017-07-17T10:52:00.000Z","296","402","286"],["2017-07-17T10:53:00.000Z","106","163","197"]]
But I'm having troubles presenting the info, is like its crashing or something like it.. can be any bug of the lib? If i press f12 the graph appears... but onLoad the page is blank as you can see on the images on the link below
Images of the problem:
https://stackoverflow.com/questions/45142487/dygraph-with-values-and-options-but-dont-present-graph
When stretching the window from left to right and vice versa, the graph gets continually smaller until it the height of the div containing the graph goes to the height of the legend plus a margin.
In your scope.$watch('data'...
, you have complete the update of the graph with a call to resize()
. While this may not be an issue for static plotting, if you do use this in a dynamic situation, this function call will result in a performance hit.
Hi,
Sorry to bother you with this question. The project works great. I have 2 data sets that i need to draw. The server returns data as 2 separate json's. Do i have to merge the 2 jsons to create the data as one set?
For ex: in all the samples the data is shown as "x","a","b" but my data comes as
"x","a" and "x", "b". Is there a way to first add data for "a" and then add the data for "b"?
Would appreciate any pointers.
Thanks,
Srini
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.