Skip to content

Commit

Permalink
fixes #201.
Browse files Browse the repository at this point in the history
- add example
  • Loading branch information
pablojim committed Jan 30, 2017
1 parent ad0b3fb commit 5881854
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 18 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ AngularJS directive for Highcharts

A simple Angularjs directive for Highcharts.

Google Group: https://groups.google.com/forum/#!forum/highcharts-ng

Basic jsfiddle: http://jsfiddle.net/gh/get/jquery/3.1.1/pablojim/highcharts-ng/tree/master/jsfiddles/basic/
Examples:
---------

Polar jsfiddle: http://jsfiddle.net/gh/get/jquery/3.1.1/pablojim/highcharts-ng/tree/master/jsfiddles/polar/
- Basic: http://jsfiddle.net/gh/get/jquery/3.1.1/pablojim/highcharts-ng/tree/master/jsfiddles/basic/
- Polar Chart: http://jsfiddle.net/gh/get/jquery/3.1.1/pablojim/highcharts-ng/tree/master/jsfiddles/polar/
- Multi Axis: http://jsfiddle.net/gh/get/jquery/3.1.1/pablojim/highcharts-ng/tree/master/jsfiddles/multi_axis/


See example in ./example/charts/general-example.html (Also served here: https://rawgit.com/pablojim/highcharts-ng/master/example/charts/general-example.html)
Expand Down
8 changes: 1 addition & 7 deletions dist/highcharts-ng.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* highcharts-ng
* @version v1.0.1-dev - 2017-01-14
* @version v1.0.1-dev - 2017-01-30
* @link https://github.com/pablojim/highcharts-ng
* @author Barry Fitzgerald <>
* @license MIT License, http://www.opensource.org/licenses/MIT
Expand Down Expand Up @@ -93,12 +93,6 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
credits: {},
plotOptions: {},
navigator: {},
xAxis: {
events: {}
},
yAxis: {
events: {}
}
};

if (config) {
Expand Down
4 changes: 2 additions & 2 deletions dist/highcharts-ng.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions jsfiddles/multi_axis/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
name: Basic Highcharts-ng demo
description: Mulit axis Highcharts-ng demo
authors:
- pablojim
normalize_css: no
...
21 changes: 21 additions & 0 deletions jsfiddles/multi_axis/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js"></script>
<script src="https://rawgithub.com/pablojim/highcharts-ng/master/src/highcharts-ng.js"></script>
<script src="https://code.highcharts.com/stock/highstock.src.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

<div ng-app="myapp">
<div ng-controller="myctrl">
<div class="span12">
<input ng-model="chartConfig.title.text">
<button ng-click="addSeries()">Add Series</button>
<button ng-click="addPoints()">Add Points to Random Series</button>
<button ng-click="removeRandomSeries()">Remove Random Series</button>
<button ng-click="swapChartType()">Line/Bar</button>
</div>
<div class="row">
<highchart id="chart1" config="chartConfig" class="span10"></highchart>
</div>
</div>
</div>

<h3><a href="https://github.com/pablojim/highcharts-ng">See Highcharts-ng on github</a></h3>
68 changes: 68 additions & 0 deletions jsfiddles/multi_axis/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//See: https://github.com/pablojim/highcharts-ng

$(function () {
var myapp = angular.module('myapp', ["highcharts-ng"]);

myapp.controller('myctrl', function ($scope) {

$scope.addPoints = function () {
var seriesArray = $scope.chartConfig.series;
var rndIdx = Math.floor(Math.random() * seriesArray.length);
seriesArray[rndIdx].data = seriesArray[rndIdx].data.concat([1, 10, 20]);
};

var series = 0;
$scope.addSeries = function () {
var rnd = [];
for (var i = 0; i < 10; i++) {
rnd.push(Math.floor(Math.random() * 20) + 1);
}
$scope.chartConfig.series.push({
data: rnd,
id: 'series_' + series++
});
}

$scope.removeRandomSeries = function () {
var seriesArray = $scope.chartConfig.series
var rndIdx = Math.floor(Math.random() * seriesArray.length);
seriesArray.splice(rndIdx, 1);
}

$scope.swapChartType = function () {
if (this.chartConfig.chart.type === 'line') {
this.chartConfig.chart.type = 'bar';
} else {
this.chartConfig.chart.type = 'line';
this.chartConfig.chart.zoomType = 'x';
}
}

$scope.chartConfig = {
chart: {
type: 'bar'
},
series: [{
data: [10, 15, 12, 8, 7],
id: 'series1'
}],
title: {
text: 'Hello'
},
xAxis: [{
type: 'datetime'
}],
yAxis: [{ // Primary yAxis
title: {
text: 'number of notification',
}
}, { // Secondary yAxis
title: {
text: 'usage time',
},
opposite: true
}],
};

});
})
6 changes: 0 additions & 6 deletions src/highcharts-ng.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@ if (typeof module !== 'undefined' && typeof exports !== 'undefined' && module.ex
credits: {},
plotOptions: {},
navigator: {},
xAxis: {
events: {}
},
yAxis: {
events: {}
}
};

if (config) {
Expand Down

0 comments on commit 5881854

Please sign in to comment.