Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
fix temp gauge resizing
Browse files Browse the repository at this point in the history
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
  • Loading branch information
Musilah committed Mar 13, 2024
1 parent 10de76b commit 0f89e07
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
27 changes: 24 additions & 3 deletions ui/web/static/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1842,9 +1842,21 @@ class StepChart extends Echart {
class TempGaugeChart extends Echart {
constructor(chartData, widgetID) {
super(widgetID, chartData);
this.Style = {
width: "480px",
height: "420px",
};
this.Content = this.#generateContent();
this.Script = this.#generateScript();
}

#generateContent() {
return `
<div class="item-content" id="${this.ID}" style="width: ${this.Style.width}; height: ${this.Style.height};">
</div>
`;
}

#generateScript() {
return `
(function() {
Expand All @@ -1865,7 +1877,6 @@ class TempGaugeChart extends Echart {
endAngle: -20,
min: ${this.chartData.minValue},
max: ${this.chartData.maxValue},
splitNumber: 12,
itemStyle: {
color: '#FFAB91'
},
Expand Down Expand Up @@ -1919,7 +1930,12 @@ class TempGaugeChart extends Echart {
formatter: '{value} °C',
color: 'inherit'
},
data: []
data: [
{
value: "${this.chartData.minValue}",
name: "${this.chartData.gaugeLabel}"
}
]
},
{
type: 'gauge',
Expand Down Expand Up @@ -1953,7 +1969,12 @@ class TempGaugeChart extends Echart {
detail: {
show: false
},
data: []
data: [
{
value: "${this.chartData.minValue}",
name: "${this.chartData.gaugeLabel}",
}
]
}
]
};
Expand Down
4 changes: 3 additions & 1 deletion ui/web/templates/charts/multigaugemodal.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ <h5 class="modal-title" id="multiGaugeModalLabel">Multi Gauge Chart</h5>
placeholder="Enter three value names eg. temperature,voltage"
required
/>
<div class="invalid-feedback">Please enter three value names without spaces between them</div>
<div class="invalid-feedback">
Please enter three value names without spaces between them
</div>
</div>
</div>
<!-- Appearance Tab -->
Expand Down

0 comments on commit 0f89e07

Please sign in to comment.