-
Notifications
You must be signed in to change notification settings - Fork 462
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add example
- Loading branch information
Showing
7 changed files
with
104 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}], | ||
}; | ||
|
||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters