Skip to content

Commit 53d6e4e

Browse files
committed
Release 1.7.0
1 parent 3296e33 commit 53d6e4e

File tree

7 files changed

+184
-5
lines changed

7 files changed

+184
-5
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,25 @@ All notable changes to this project will be documented in this file. Dates are d
44

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

7+
#### [v1.7.0](https://github.com/toorshia/justgage/compare/v1.6.1...v1.7.0)
8+
9+
- feat: add targetLine [`#398`](https://github.com/toorshia/justgage/pull/398)
10+
- chore: bump vm2 from 3.9.17 to 3.9.18 [`#393`](https://github.com/toorshia/justgage/pull/393)
11+
- chore: bump vm2 from 3.9.16 to 3.9.17 [`#391`](https://github.com/toorshia/justgage/pull/391)
12+
- chore: bump vm2 from 3.9.15 to 3.9.16 [`#389`](https://github.com/toorshia/justgage/pull/389)
13+
- chore: bump vm2 from 3.9.11 to 3.9.15 [`#388`](https://github.com/toorshia/justgage/pull/388)
14+
- chore: bump cacheable-request from 10.2.3 to 10.2.7 [`#387`](https://github.com/toorshia/justgage/pull/387)
15+
- chore: bump qs from 6.10.2 to 6.11.0 [`#383`](https://github.com/toorshia/justgage/pull/383)
16+
- chore: bump http-cache-semantics from 4.1.0 to 4.1.1 [`#386`](https://github.com/toorshia/justgage/pull/386)
17+
- chore: fix some audit issue [`40f79b9`](https://github.com/toorshia/justgage/commit/40f79b9c396f58fdd76c6cf140b08e038daefa06)
18+
- style: fix lint issues [`3296e33`](https://github.com/toorshia/justgage/commit/3296e33067c6c2a5b142af1e731d971784ad99b3)
19+
- docs: improved destroy example [`d62b827`](https://github.com/toorshia/justgage/commit/d62b827d04d6ed3933c6ea4158335b2a7f478311)
20+
721
#### [v1.6.1](https://github.com/toorshia/justgage/compare/v1.6.0...v1.6.1)
822

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

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

dist/justgage.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@
207207
dataset,
208208
">"
209209
),
210+
// targetLine : float
211+
// value for the target line (optional)
212+
targetLine: kvLookup("targetLine", config, dataset, null, "float"),
213+
214+
// targetLineColor : string
215+
// color of the target line
216+
targetLineColor: kvLookup("targetLineColor", config, dataset, "#000000"),
217+
218+
// targetLineWidth : float
219+
// width of the target line
220+
targetLineWidth: kvLookup("targetLineWidth", config, dataset, 1.5),
210221

211222
// donutStartAngle : int
212223
// angle to start from when in donut mode
@@ -765,6 +776,9 @@
765776
],
766777
});
767778

779+
// Draw the Target Line
780+
obj.drawTargetLine();
781+
768782
if (obj.config.donut) {
769783
obj.level.transform(
770784
"r" +
@@ -1376,6 +1390,73 @@
13761390
}
13771391
};
13781392

1393+
JustGage.prototype.drawTargetLine = function () {
1394+
const obj = this;
1395+
1396+
if (obj.config.targetLine === null) {
1397+
return;
1398+
}
1399+
1400+
let path;
1401+
const w = obj.params.widgetW;
1402+
const h = obj.params.widgetH;
1403+
const dx = obj.params.dx;
1404+
const dy = obj.params.dy;
1405+
const gws = obj.config.gaugeWidthScale;
1406+
const donut = obj.config.donut;
1407+
1408+
const alpha =
1409+
(1 -
1410+
(obj.config.targetLine - obj.config.min) /
1411+
(obj.config.max - obj.config.min)) *
1412+
Math.PI;
1413+
let Ro = w / 2 - w / 10;
1414+
let Ri = Ro - (w / 6.666666666666667) * gws;
1415+
1416+
let Cx, Cy, Xo, Yo, Xi, Yi;
1417+
1418+
if (donut) {
1419+
Ro = w / 2 - w / 30;
1420+
Ri = Ro - (w / 6.666666666666667) * gws;
1421+
1422+
Cx = w / 2 + dx;
1423+
Cy = h / 2 + dy;
1424+
1425+
Xo = Cx + Ro * Math.cos(alpha);
1426+
Yo = Cy - Ro * Math.sin(alpha);
1427+
Xi = Cx + Ri * Math.cos(alpha);
1428+
Yi = Cy - Ri * Math.sin(alpha);
1429+
1430+
path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
1431+
} else {
1432+
Cx = w / 2 + dx;
1433+
Cy = h / 1.25 + dy;
1434+
1435+
Xo = Cx + Ro * Math.cos(alpha);
1436+
Yo = Cy - Ro * Math.sin(alpha);
1437+
Xi = Cx + Ri * Math.cos(alpha);
1438+
Yi = Cy - Ri * Math.sin(alpha);
1439+
1440+
path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
1441+
}
1442+
1443+
obj.targetLine = obj.canvas.path(path).attr({
1444+
stroke: obj.config.targetLineColor,
1445+
"stroke-width": obj.config.targetLineWidth,
1446+
});
1447+
1448+
if (donut) {
1449+
obj.targetLine.transform(
1450+
"r" +
1451+
obj.config.donutStartAngle +
1452+
"," +
1453+
(w / 2 + dx) +
1454+
"," +
1455+
(h / 2 + dy)
1456+
);
1457+
}
1458+
};
1459+
13791460
//
13801461
// tiny helper function to lookup value of a key from two hash tables
13811462
// if none found, return defaultvalue

dist/justgage.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/justgage.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/justgage.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,17 @@
207207
dataset,
208208
">"
209209
),
210+
// targetLine : float
211+
// value for the target line (optional)
212+
targetLine: kvLookup("targetLine", config, dataset, null, "float"),
213+
214+
// targetLineColor : string
215+
// color of the target line
216+
targetLineColor: kvLookup("targetLineColor", config, dataset, "#000000"),
217+
218+
// targetLineWidth : float
219+
// width of the target line
220+
targetLineWidth: kvLookup("targetLineWidth", config, dataset, 1.5),
210221

211222
// donutStartAngle : int
212223
// angle to start from when in donut mode
@@ -765,6 +776,9 @@
765776
],
766777
});
767778

779+
// Draw the Target Line
780+
obj.drawTargetLine();
781+
768782
if (obj.config.donut) {
769783
obj.level.transform(
770784
"r" +
@@ -1376,6 +1390,73 @@
13761390
}
13771391
};
13781392

1393+
JustGage.prototype.drawTargetLine = function () {
1394+
const obj = this;
1395+
1396+
if (obj.config.targetLine === null) {
1397+
return;
1398+
}
1399+
1400+
let path;
1401+
const w = obj.params.widgetW;
1402+
const h = obj.params.widgetH;
1403+
const dx = obj.params.dx;
1404+
const dy = obj.params.dy;
1405+
const gws = obj.config.gaugeWidthScale;
1406+
const donut = obj.config.donut;
1407+
1408+
const alpha =
1409+
(1 -
1410+
(obj.config.targetLine - obj.config.min) /
1411+
(obj.config.max - obj.config.min)) *
1412+
Math.PI;
1413+
let Ro = w / 2 - w / 10;
1414+
let Ri = Ro - (w / 6.666666666666667) * gws;
1415+
1416+
let Cx, Cy, Xo, Yo, Xi, Yi;
1417+
1418+
if (donut) {
1419+
Ro = w / 2 - w / 30;
1420+
Ri = Ro - (w / 6.666666666666667) * gws;
1421+
1422+
Cx = w / 2 + dx;
1423+
Cy = h / 2 + dy;
1424+
1425+
Xo = Cx + Ro * Math.cos(alpha);
1426+
Yo = Cy - Ro * Math.sin(alpha);
1427+
Xi = Cx + Ri * Math.cos(alpha);
1428+
Yi = Cy - Ri * Math.sin(alpha);
1429+
1430+
path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
1431+
} else {
1432+
Cx = w / 2 + dx;
1433+
Cy = h / 1.25 + dy;
1434+
1435+
Xo = Cx + Ro * Math.cos(alpha);
1436+
Yo = Cy - Ro * Math.sin(alpha);
1437+
Xi = Cx + Ri * Math.cos(alpha);
1438+
Yi = Cy - Ri * Math.sin(alpha);
1439+
1440+
path = "M" + Xi + "," + Yi + " L" + Xo + "," + Yo;
1441+
}
1442+
1443+
obj.targetLine = obj.canvas.path(path).attr({
1444+
stroke: obj.config.targetLineColor,
1445+
"stroke-width": obj.config.targetLineWidth,
1446+
});
1447+
1448+
if (donut) {
1449+
obj.targetLine.transform(
1450+
"r" +
1451+
obj.config.donutStartAngle +
1452+
"," +
1453+
(w / 2 + dx) +
1454+
"," +
1455+
(h / 2 + dy)
1456+
);
1457+
}
1458+
};
1459+
13791460
//
13801461
// tiny helper function to lookup value of a key from two hash tables
13811462
// if none found, return defaultvalue

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "justgage",
3-
"version": "1.6.1",
3+
"version": "1.7.0",
44
"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.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)