I'm a solution architect. Love everything web & scalability
rootux / angular-highcharts-directive Goto Github PK
View Code? Open in Web Editor NEWAn Angular Js Directive which allows to simplify the use of Highcharts charts
License: MIT License
An Angular Js Directive which allows to simplify the use of Highcharts charts
License: MIT License
When I try to use this directive I get error
Highcharts error #13: www.highcharts.com/errors/13
This error occurs if the chart.renderTo option is misconfugured so that Highcharts is unable to find the HTML element to render the chart in.
When trying to use events in configuration, we cannot pass functions as the angular-highcharts-directive parses the configuration as JSON which doesn't allow functions. This sucks.
$http.get('/api/chart').success(function (data) {
data.plotOptions.scatter.point = {
events: {
click: function(event) {
console.log('scatter point event click'); // this doesn't fire
}
}
}
$scope.chart = data;
});
In your screenshot you have this code:
value='{{basicAreaChart}}'
But it should be this:
value='basicAreaChart'
i had to change a line in your directive to get it work using your data for compatibility i reccomend you merge these. Sorry, for not making a commit myself
return {
restrict: 'ACE',
template: '<div></div>',
scope: {
chartData: "=value",
chartObj: "=?"
},
transclude: true,
replace: true,
link: function($scope, $element, $attrs) {
//Update when charts data changes
$scope.$watch('chartData', function(value) {
if (!value)
return;
if (!$scope.chartData.chart) <--- THIS LINE
$scope.chartData.chart = {}; <--- ALSO THIS
// use default values if nothing is specified in the given settings
$scope.chartData.chart.renderTo = $scope.chartData.chart.renderTo || $element[0];
if ($attrs.type)
$scope.chartData.chart.type = $scope.chartData.chart.type || $attrs.type;
if ($attrs.height)
$scope.chartData.chart.height = $scope.chartData.chart.height || $attrs.height;
if ($attrs.width)
$scope.chartData.chart.width = $scope.chartData.chart.type || $attrs.width;
$scope.chartObj = new Highcharts.Chart($scope.chartData);
});
}
};
FYI, i noticed there isn't a tag corresponding to the current version of the lib. If you just run the following commands people will be able to specify the version they want...
$ git tag v0.4.0
$ git push origin v0.4.0
in normal highchart i get svg code with code like this
var chart = $('#container').highcharts()
svg = chart.getSVG();
So, how can i get svg code with this directive???
i try like normal code but i didn't get svg code.
Thank's....
Error: Invalid isolate scope definition for directive chart: =?
$CompileProvider/this.$get</applyDirectivesToNode/nodeLinkFn/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:4196
forEach@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:117
nodeLinkFn@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:4142
compositeLinkFn@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:3848
compositeLinkFn@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:3854
publicLinkFn@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:3763
update@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:13890
$RootScopeProvider/this.$get</Scope.prototype.$broadcast@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:8090
$RouteProvider/this.$get</updateRoute/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:7250
qFactory/defer/deferred.promise.then/wrappedCallback@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:6650
qFactory/defer/deferred.promise.then/wrappedCallback@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:6650
qFactory/ref/<.then/<@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:6687
$RootScopeProvider/this.$get</Scope.prototype.$eval@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:7840
$RootScopeProvider/this.$get</Scope.prototype.$digest@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:7707
$RootScopeProvider/this.$get</Scope.prototype.$apply@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:7926
done@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:8933
completeRequest@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:9073
createHttpBackend/</xhr.onreadystatechange@https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js:9044
https://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.js
Line 5582
If you try to use this directive for Highcharts in a carousel, it results in the following error:
TypeError: Cannot read property 'length' of undefined at Object.ob.setMaxTicks
This seems to be caused by the following css in Bootstrap:
.carousel-inner > .item { display: none }
If I add an override with "display: block" to my stylesheet, everything
works, but the charts are stacked instead of in a carousel. The good news
is all the charts are rendered successfully.
A seemingly better solution is to modify the directive to show/hide the
"item" element so Highcharts is able to write to it.
if (element.parent().not(':visible')) {
element.parent().show();
}
var chart = new Highcharts.Chart(newSettings);
if (scope.$last) {
$.each(element.parent().siblings(), function() {
$(this).attr('style', '');
});
element.parent().attr('style', '');
}
More info at https://groups.google.com/group/angular/browse_thread/thread/5a5cc0f0ed98104f/652d8b52dbbe0709
Is it possible to remove the JQuery dependency?
At https://github.com/rootux/angular-highcharts-directive/blob/master/src/directives/highchart.js#L18 there's an extra comma that should be removed.
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library rootux/angular-highcharts-directive
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "rootux/angular-highcharts-directive",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
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.