Skip to content

Commit

Permalink
Merge pull request #20 from jceddy/master
Browse files Browse the repository at this point in the history
Update package.json
  • Loading branch information
gipong authored Mar 17, 2020
2 parents af299e4 + eb9a80c commit b594281
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 39 deletions.
29 changes: 17 additions & 12 deletions dist/ctrl.js

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

6 changes: 3 additions & 3 deletions dist/external/groupedBarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default class groupedBarChart {
constructor(opts) {
this.data = opts.data;
this.margin = opts.margin;
this.width = opts.width;
this.height = opts.height;
this.width = parseInt(opts.width, 10);
this.height = parseInt(opts.height, 10);
this.showLegend = opts.legend;
this.legendType = opts.position;
this.chartType = opts.chartType;
Expand Down Expand Up @@ -280,4 +280,4 @@ export default class groupedBarChart {
this.tips = d3.select(this.element).append('div')
.attr('class', 'toolTip');
}
}
}
3 changes: 2 additions & 1 deletion dist/partials/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ <h5 class="section-heading">Label</h5>
</div>
</div>
<gf-form-switch class="gf-form" label="Show Average Line" label-class="width-11" checked="ctrl.panel.avgLineShow" on-change="ctrl.render()"></gf-form-switch>
<gf-form-switch class="gf-form" label="Show Bar Values" label-class="width-11" checked="ctrl.panel.barValuesShow" on-change="ctrl.render()"></gf-form-switch>
<div class="gf-form">
<span class="gf-form-label width-11">FontColor</span>
<span class="gf-form-label">
Expand Down Expand Up @@ -58,4 +59,4 @@ <h5 class="section-heading">Layout</h5>
</div>
</div>
</div>
</div>
</div>
6 changes: 3 additions & 3 deletions dist/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
{"name": "options", "path": "src/img/groupedbarchart-options.png"},
{"name": "colors", "path": "src/img/groupedbarchart-colors.png"}
],
"version": "1.0.0",
"updated": "2017-12-23"
"version": "1.0.3",
"updated": "2020-03-16"
},

"dependencies": {
"grafanaVersion": "4.6",
"plugins": [ ]
}
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "groupedbarchart-panel",
"private": true,
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"repository": {
"type": "git",
"url": "https://github.com/jceddy/grafana-groupedbarchart-panel.git"
"url": "https://github.com/gipong/grafana-groupedbarchart-panel.git"
},
"author": "gipong",
"license": "MIT",
Expand Down
33 changes: 19 additions & 14 deletions src/ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const panelDefaults = {
labelOrientation: 'horizontal',
orientation: 'vertical',
avgLineShow: true,
barValuesShow: true,
labelSpace: 40,
links: [],
datasource: null,
Expand Down Expand Up @@ -120,6 +121,7 @@ export class GroupedBarChartCtrl extends MetricsPanelCtrl {
this.fontColor = opts.fontColor;
this.labelOrientation = opts.labelOrientation;
this.avgLineShow = opts.avgLineShow;
this.barValuesShow = opts.barValuesShow;
this.axesConfig = [];
this.element = elem.find(opts.element)[0];
this.options = [];
Expand Down Expand Up @@ -337,20 +339,22 @@ export class GroupedBarChartCtrl extends MetricsPanelCtrl {
break;
}

(this.chartType === 'bar chart') && this.barC.append('text')
.attr('x', d => {
return (this.orientation === 'horizontal')
? this.x(d.value) +5
: this.x1(d.name) + this.x1.rangeBand()/4 + this.margin.left;
})
.attr('y', d => {
return (this.orientation === 'horizontal')
? this.y1(d.name) +(this.y1.rangeBand()/2)
: this.y(d.value) - this.height -8;
})
.attr('dy', '.35em')
.style('fill', `${this.fontColor}`)
.text(d => { return d.value ? d.value : ''; });
if(this.barValuesShow) {
(this.chartType === 'bar chart') && this.barC.append('text')
.attr('x', d => {
return (this.orientation === 'horizontal')
? this.x(d.value) +5
: this.x1(d.name) + this.x1.rangeBand()/4 + this.margin.left;
})
.attr('y', d => {
return (this.orientation === 'horizontal')
? this.y1(d.name) +(this.y1.rangeBand()/2)
: this.y(d.value) - this.height -8;
})
.attr('dy', '.35em')
.style('fill', `${this.fontColor}`)
.text(d => { return d.value ? d.value : ''; });
}

this.bar.on('mouseover', d => {
this.tips.style('left', `${10}px`);
Expand Down Expand Up @@ -443,6 +447,7 @@ export class GroupedBarChartCtrl extends MetricsPanelCtrl {
labelOrientation: ctrl.panel.labelOrientation,
labelSpace: ctrl.panel.labelSpace,
avgLineShow: ctrl.panel.avgLineShow,
barValuesShow: ctrl.panel.barValuesShow,
color: ctrl.panel.colorSch
});

Expand Down
3 changes: 2 additions & 1 deletion src/partials/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ <h5 class="section-heading">Label</h5>
</div>
</div>
<gf-form-switch class="gf-form" label="Show Average Line" label-class="width-11" checked="ctrl.panel.avgLineShow" on-change="ctrl.render()"></gf-form-switch>
<gf-form-switch class="gf-form" label="Show Bar Values" label-class="width-11" checked="ctrl.panel.barValuesShow" on-change="ctrl.render()"></gf-form-switch>
<div class="gf-form">
<span class="gf-form-label width-11">FontColor</span>
<span class="gf-form-label">
Expand Down Expand Up @@ -58,4 +59,4 @@ <h5 class="section-heading">Layout</h5>
</div>
</div>
</div>
</div>
</div>
6 changes: 3 additions & 3 deletions src/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
{"name": "options", "path": "src/img/groupedbarchart-options.png"},
{"name": "colors", "path": "src/img/groupedbarchart-colors.png"}
],
"version": "1.0.0",
"updated": "2017-12-23"
"version": "1.0.3",
"updated": "2020-03-16"
},

"dependencies": {
"grafanaVersion": "4.6",
"plugins": [ ]
}
}
}

0 comments on commit b594281

Please sign in to comment.