Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
add horizontal bar
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcraig committed Sep 4, 2016
1 parent 5ce8b2a commit a172ad9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ You will then have access to the following directives:
- tc-chartjs
- tc-chartjs-line
- tc-chartjs-bar
- tc-chartjs-horizontalbar
- tc-chartjs-radar
- tc-chartjs-polararea
- tc-chartjs-pie
Expand Down Expand Up @@ -99,6 +100,7 @@ Available Types:

- line
- bar
- horizontalbar
- radar
- polararea
- pie
Expand Down
20 changes: 20 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ <h2>Bar Chart</h2>

<hr>

<div class="row" ng-controller="BarController">
<div class="col-md-12">
<h2>Horizontal Bar Chart</h2>
</div>
<div class="col-md-8">
<canvas
tc-chartjs-horizontalbar
chart-data="chartData"
chart-options="chartOptions"
chart-click="onChartClick(event)"
chart-legend="horizontalBarChart"
></canvas>
</div>
<div class="col-md-4">
<div tc-chartjs-legend chart-legend="horizontalBarChart" class="tc-chart-js-legend"></div>
</div>
</div>

<hr>

<div class="row" ng-controller="BubbleController">
<div class="col-md-12">
<h2>Bubble Chart</h2>
Expand Down
8 changes: 8 additions & 0 deletions dist/tc-angular-chartjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
TcChartjs.$inject = ["TcChartjsFactory"];
TcChartjsLine.$inject = ["TcChartjsFactory"];
TcChartjsBar.$inject = ["TcChartjsFactory"];
TcChartjsHorizontalBar.$inject = ["TcChartjsFactory"];
TcChartjsRadar.$inject = ["TcChartjsFactory"];
TcChartjsPolararea.$inject = ["TcChartjsFactory"];
TcChartjsPie.$inject = ["TcChartjsFactory"];
Expand All @@ -25,6 +26,7 @@ TcChartjsBubble.$inject = ["TcChartjsFactory"];angular
.directive('tcChartjs', TcChartjs)
.directive('tcChartjsLine', TcChartjsLine)
.directive('tcChartjsBar', TcChartjsBar)
.directive('tcChartjsHorizontalbar', TcChartjsHorizontalBar)
.directive('tcChartjsRadar', TcChartjsRadar)
.directive('tcChartjsPolararea', TcChartjsPolararea)
.directive('tcChartjsPie', TcChartjsPie)
Expand All @@ -45,6 +47,10 @@ function TcChartjsBar(TcChartjsFactory) {
return new TcChartjsFactory('bar');
}

function TcChartjsHorizontalBar(TcChartjsFactory) {
return new TcChartjsFactory('horizontalbar');
}

function TcChartjsRadar(TcChartjsFactory) {
return new TcChartjsFactory('radar');
}
Expand Down Expand Up @@ -162,6 +168,8 @@ function TcChartjsFactory() {
switch (typeLowerCase) {
case 'polararea':
return 'polarArea';
case 'horizontalbar':
return 'horizontalBar';
default:
return type;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/tc-angular-chartjs.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 src/tc-angular-chartjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ angular
.directive('tcChartjs', TcChartjs)
.directive('tcChartjsLine', TcChartjsLine)
.directive('tcChartjsBar', TcChartjsBar)
.directive('tcChartjsHorizontalbar', TcChartjsHorizontalBar)
.directive('tcChartjsRadar', TcChartjsRadar)
.directive('tcChartjsPolararea', TcChartjsPolararea)
.directive('tcChartjsPie', TcChartjsPie)
Expand All @@ -23,6 +24,10 @@ function TcChartjsBar(TcChartjsFactory) {
return new TcChartjsFactory('bar');
}

function TcChartjsHorizontalBar(TcChartjsFactory) {
return new TcChartjsFactory('horizontalbar');
}

function TcChartjsRadar(TcChartjsFactory) {
return new TcChartjsFactory('radar');
}
Expand Down Expand Up @@ -140,6 +145,8 @@ function TcChartjsFactory() {
switch (typeLowerCase) {
case 'polararea':
return 'polarArea';
case 'horizontalbar':
return 'horizontalBar';
default:
return type;
}
Expand Down

0 comments on commit a172ad9

Please sign in to comment.