* Draw the complete gauge * @private
()
| 154 | * @private |
| 155 | */ |
| 156 | _drawGauge() { |
| 157 | const config = this.config; |
| 158 | |
| 159 | // Calculate widget dimensions using original algorithm |
| 160 | const { widgetW, widgetH, dx, dy } = this._calculateGaugeGeometry(); |
| 161 | |
| 162 | // Draw gauge background using original path generation |
| 163 | const gaugePath = this.renderer.createGaugePath( |
| 164 | config.max, |
| 165 | config.min, |
| 166 | config.max, |
| 167 | widgetW, |
| 168 | widgetH, |
| 169 | dx, |
| 170 | dy, |
| 171 | config.gaugeWidthScale || 1.0, |
| 172 | config.donut, |
| 173 | false // this is relevant only for level drawing |
| 174 | ); |
| 175 | |
| 176 | this.canvas.gauge = this.renderer.path(gaugePath).attr({ |
| 177 | fill: config.gaugeColor, |
| 178 | stroke: 'none', |
| 179 | }); |
| 180 | |
| 181 | // Apply donut rotation to background gauge (like original) |
| 182 | this._applyDonutRotation(this.canvas.gauge, config, widgetW, widgetH, dx, dy); |
| 183 | |
| 184 | // Draw value level or sector colors based on configuration |
| 185 | if (config.showSectorColors) { |
| 186 | // Draw static sector colors once (uses customSectors, levelColors, or gaugeColor) |
| 187 | this._drawSectorColors(); |
| 188 | } else { |
| 189 | // Draw value level (start from appropriate value for animation) |
| 190 | // Differential gauges start from middle (0), regular gauges from min |
| 191 | const startValue = config.differential ? (config.max + config.min) / 2 : config.min; |
| 192 | this._drawLevel(startValue); |
| 193 | } |
| 194 | |
| 195 | // Draw labels |
| 196 | this._drawLabels(); |
| 197 | |
| 198 | // Draw pointer if enabled |
| 199 | if (config.pointer) { |
| 200 | this._drawPointer(); |
| 201 | } |
| 202 | |
| 203 | this._drawTargetLine(); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * Draw gauge level (filled arc) |
no test coverage detected