Skip to content

Commit

Permalink
push the latest changes to the temp branch
Browse files Browse the repository at this point in the history
  • Loading branch information
e-tinkers committed Oct 28, 2021
1 parent 832ff99 commit 3daa7d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/gauge.min.js

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

6 changes: 2 additions & 4 deletions example.js
Expand Up @@ -5,17 +5,15 @@
*/
document.addEventListener('DOMContentLoaded', () => {

// create an Gauge instance with default construct, and set configuration later
const powerGauge = new Gauge();
powerGuage.setConfig({
const powerGauge = new Gauge({
minValue: 5,
maxValue: 300000,
lowThreshhold: 300,
highThreshhold: 2000,
scale: 'log',
displayUnit: 'Log10(x)'
});
// create an Guage instance with pass-in configuration object

const powerGauge2 = new Gauge({
minValue: 10,
maxValue: 60,
Expand Down
9 changes: 4 additions & 5 deletions source/gauge.js
Expand Up @@ -28,10 +28,9 @@ class Gauge {
this.maxAngle = 90,
this.angleRange = this.maxAngle - this.minAngle;

if (configuration !== undefined) {
this.config = Object.assign(config, configuration);
this._config(configuration);
}
this.config = Object.assign(config, configuration);
this._config();

}

_config() {
Expand Down Expand Up @@ -69,7 +68,7 @@ class Gauge {

let ticks = this.config.majorTicks;
if (this.config.scale === 'log') {
ticks = Math.log10(this.config.maxValue/this.minValue);
ticks = Math.log10(this.config.maxValue/this.config.minValue);
}
this.ticks = this.scale.ticks(ticks);

Expand Down

0 comments on commit 3daa7d3

Please sign in to comment.