Skip to content

Commit

Permalink
Fix Pie labels
Browse files Browse the repository at this point in the history
  • Loading branch information
clavay committed May 28, 2019
1 parent ca1553a commit 6140e0a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pyscada/hmi/static/pyscada/js/pyscada/pyscada_v0-7-0rc14.js
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,16 @@ function Pie(id){
main_chart_area.height(contentAreaHeight);
}

// Since CSS transforms use the top-left corner of the label as the transform origin,
// we need to center the y-axis label by shifting it down by half its width.
// Subtract 20 to factor the chart's bottom margin into the centering.
var chartTitle = $(chart_container_id + ' .chartTitle');
chartTitle.css("margin-left", -chartTitle.width() / 2);
var xaxisLabel = $(chart_container_id + ' .axisLabel.xaxisLabel');
xaxisLabel.css("margin-left", -xaxisLabel.width() / 2);
var yaxisLabel = $(chart_container_id + ' .axisLabel.yaxisLabel');
yaxisLabel.css("margin-top", yaxisLabel.width() / 2 - 20);

if (series.length > 0) {
flotPlot = $.plot($(chart_container_id + ' .chart-placeholder'), series, options)
}
Expand Down

0 comments on commit 6140e0a

Please sign in to comment.