Skip to content

Commit

Permalink
Release 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Jul 16, 2024
1 parent 3296e33 commit 53d6e4e
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 5 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v1.7.0](https://github.com/toorshia/justgage/compare/v1.6.1...v1.7.0)

- feat: add targetLine [`#398`](https://github.com/toorshia/justgage/pull/398)
- chore: bump vm2 from 3.9.17 to 3.9.18 [`#393`](https://github.com/toorshia/justgage/pull/393)
- chore: bump vm2 from 3.9.16 to 3.9.17 [`#391`](https://github.com/toorshia/justgage/pull/391)
- chore: bump vm2 from 3.9.15 to 3.9.16 [`#389`](https://github.com/toorshia/justgage/pull/389)
- chore: bump vm2 from 3.9.11 to 3.9.15 [`#388`](https://github.com/toorshia/justgage/pull/388)
- chore: bump cacheable-request from 10.2.3 to 10.2.7 [`#387`](https://github.com/toorshia/justgage/pull/387)
- chore: bump qs from 6.10.2 to 6.11.0 [`#383`](https://github.com/toorshia/justgage/pull/383)
- chore: bump http-cache-semantics from 4.1.0 to 4.1.1 [`#386`](https://github.com/toorshia/justgage/pull/386)
- chore: fix some audit issue [`40f79b9`](https://github.com/toorshia/justgage/commit/40f79b9c396f58fdd76c6cf140b08e038daefa06)
- style: fix lint issues [`3296e33`](https://github.com/toorshia/justgage/commit/3296e33067c6c2a5b142af1e731d971784ad99b3)
- docs: improved destroy example [`d62b827`](https://github.com/toorshia/justgage/commit/d62b827d04d6ed3933c6ea4158335b2a7f478311)

#### [v1.6.1](https://github.com/toorshia/justgage/compare/v1.6.0...v1.6.1)

> 2 December 2022
- Release 1.6.1 [`2793743`](https://github.com/toorshia/justgage/commit/2793743ba949fdbf821f36518e1297cf092e30ce)
- fix: make differential work with all intervals [`ab0e50e`](https://github.com/toorshia/justgage/commit/ab0e50eb08cbe9a1099682212c0f0e9013a1eec4)

#### [v1.6.0](https://github.com/toorshia/justgage/compare/v1.5.1...v1.6.0)
Expand Down
81 changes: 81 additions & 0 deletions dist/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@
dataset,
">"
),
// targetLine : float
// value for the target line (optional)
targetLine: kvLookup("targetLine", config, dataset, null, "float"),

// targetLineColor : string
// color of the target line
targetLineColor: kvLookup("targetLineColor", config, dataset, "#000000"),

// targetLineWidth : float
// width of the target line
targetLineWidth: kvLookup("targetLineWidth", config, dataset, 1.5),

// donutStartAngle : int
// angle to start from when in donut mode
Expand Down Expand Up @@ -765,6 +776,9 @@
],
});

// Draw the Target Line
obj.drawTargetLine();

if (obj.config.donut) {
obj.level.transform(
"r" +
Expand Down Expand Up @@ -1376,6 +1390,73 @@
}
};

JustGage.prototype.drawTargetLine = function () {
const obj = this;

if (obj.config.targetLine === null) {
return;
}

let path;
const w = obj.params.widgetW;
const h = obj.params.widgetH;
const dx = obj.params.dx;
const dy = obj.params.dy;
const gws = obj.config.gaugeWidthScale;
const donut = obj.config.donut;

const alpha =
(1 -
(obj.config.targetLine - obj.config.min) /
(obj.config.max - obj.config.min)) *
Math.PI;
let Ro = w / 2 - w / 10;
let Ri = Ro - (w / 6.666666666666667) * gws;

let Cx, Cy, Xo, Yo, Xi, Yi;

if (donut) {
Ro = w / 2 - w / 30;
Ri = Ro - (w / 6.666666666666667) * gws;

Cx = w / 2 + dx;
Cy = h / 2 + dy;

Xo = Cx + Ro * Math.cos(alpha);
Yo = Cy - Ro * Math.sin(alpha);
Xi = Cx + Ri * Math.cos(alpha);
Yi = Cy - Ri * Math.sin(alpha);

path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
} else {
Cx = w / 2 + dx;
Cy = h / 1.25 + dy;

Xo = Cx + Ro * Math.cos(alpha);
Yo = Cy - Ro * Math.sin(alpha);
Xi = Cx + Ri * Math.cos(alpha);
Yi = Cy - Ri * Math.sin(alpha);

path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
}

obj.targetLine = obj.canvas.path(path).attr({
stroke: obj.config.targetLineColor,
"stroke-width": obj.config.targetLineWidth,
});

if (donut) {
obj.targetLine.transform(
"r" +
obj.config.donutStartAngle +
"," +
(w / 2 + dx) +
"," +
(h / 2 + dy)
);
}
};

//
// tiny helper function to lookup value of a key from two hash tables
// if none found, return defaultvalue
Expand Down
2 changes: 1 addition & 1 deletion dist/justgage.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/justgage.min.js.map

Large diffs are not rendered by default.

81 changes: 81 additions & 0 deletions docs/justgage.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@
dataset,
">"
),
// targetLine : float
// value for the target line (optional)
targetLine: kvLookup("targetLine", config, dataset, null, "float"),

// targetLineColor : string
// color of the target line
targetLineColor: kvLookup("targetLineColor", config, dataset, "#000000"),

// targetLineWidth : float
// width of the target line
targetLineWidth: kvLookup("targetLineWidth", config, dataset, 1.5),

// donutStartAngle : int
// angle to start from when in donut mode
Expand Down Expand Up @@ -765,6 +776,9 @@
],
});

// Draw the Target Line
obj.drawTargetLine();

if (obj.config.donut) {
obj.level.transform(
"r" +
Expand Down Expand Up @@ -1376,6 +1390,73 @@
}
};

JustGage.prototype.drawTargetLine = function () {
const obj = this;

if (obj.config.targetLine === null) {
return;
}

let path;
const w = obj.params.widgetW;
const h = obj.params.widgetH;
const dx = obj.params.dx;
const dy = obj.params.dy;
const gws = obj.config.gaugeWidthScale;
const donut = obj.config.donut;

const alpha =
(1 -
(obj.config.targetLine - obj.config.min) /
(obj.config.max - obj.config.min)) *
Math.PI;
let Ro = w / 2 - w / 10;
let Ri = Ro - (w / 6.666666666666667) * gws;

let Cx, Cy, Xo, Yo, Xi, Yi;

if (donut) {
Ro = w / 2 - w / 30;
Ri = Ro - (w / 6.666666666666667) * gws;

Cx = w / 2 + dx;
Cy = h / 2 + dy;

Xo = Cx + Ro * Math.cos(alpha);
Yo = Cy - Ro * Math.sin(alpha);
Xi = Cx + Ri * Math.cos(alpha);
Yi = Cy - Ri * Math.sin(alpha);

path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
} else {
Cx = w / 2 + dx;
Cy = h / 1.25 + dy;

Xo = Cx + Ro * Math.cos(alpha);
Yo = Cy - Ro * Math.sin(alpha);
Xi = Cx + Ri * Math.cos(alpha);
Yi = Cy - Ri * Math.sin(alpha);

path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
}

obj.targetLine = obj.canvas.path(path).attr({
stroke: obj.config.targetLineColor,
"stroke-width": obj.config.targetLineWidth,
});

if (donut) {
obj.targetLine.transform(
"r" +
obj.config.donutStartAngle +
"," +
(w / 2 + dx) +
"," +
(h / 2 + dy)
);
}
};

//
// tiny helper function to lookup value of a key from two hash tables
// if none found, return defaultvalue
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "justgage",
"version": "1.6.1",
"version": "1.7.0",
"description": "JustGage is a handy JavaScript plugin for generating and animating nice & clean gauges. It is based on Raphaël library for vector drawing, so it’s completely resolution independent and self-adjusting.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 53d6e4e

Please sign in to comment.