Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up, ready for PR to leeoniya #2

Merged
merged 1 commit into from
Mar 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions dist/uPlot.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3192,6 +3192,8 @@ function uPlot(opts, data, then) {
s.pxAlign = +ifNull(s.pxAlign, pxAlign);
s.pxRound = pxRoundGen(s.pxAlign);

// need a better way to know what path function we are using
// want the defults for eventMarkersPath to be different
if (s.paths.toString() == eventMarkersPath.toString())
{
s.auto = false;
Expand Down Expand Up @@ -3729,7 +3731,6 @@ function uPlot(opts, data, then) {
setFontStyle(ctx.font, textFill, "center", "center");

labels.forEach((label) => {

let text = ctx.measureText(label.text);

let textWidth = text.width;
Expand All @@ -3749,18 +3750,12 @@ function uPlot(opts, data, then) {
yOffAlign = -(text.actualBoundingBoxDescent + rectPadding);
}

console.log("text yOffAlign = " + yOffAlign);

let textCenterX = label.x;
let textCenterY = label.y + yOffAlign;

console.log("text (w,h) = (" + textWidth + ", " + textHeight + ")");

let rectTop = textCenterX - (rectWidth / 2);
let rectLeft = textCenterY - (rectHeight / 2);

console.log("rect (x,y,w,h) = (" + rectTop + ", " + rectLeft + ", " + rectWidth + ", " + rectHeight + ")");

ctx.fillStyle = rectFill;
ctx.strokeStyle = rectStroke;

Expand Down
9 changes: 2 additions & 7 deletions dist/uPlot.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3190,6 +3190,8 @@ function uPlot(opts, data, then) {
s.pxAlign = +ifNull(s.pxAlign, pxAlign);
s.pxRound = pxRoundGen(s.pxAlign);

// need a better way to know what path function we are using
// want the defults for eventMarkersPath to be different
if (s.paths.toString() == eventMarkersPath.toString())
{
s.auto = false;
Expand Down Expand Up @@ -3727,7 +3729,6 @@ function uPlot(opts, data, then) {
setFontStyle(ctx.font, textFill, "center", "center");

labels.forEach((label) => {

let text = ctx.measureText(label.text);

let textWidth = text.width;
Expand All @@ -3747,18 +3748,12 @@ function uPlot(opts, data, then) {
yOffAlign = -(text.actualBoundingBoxDescent + rectPadding);
}

console.log("text yOffAlign = " + yOffAlign);

let textCenterX = label.x;
let textCenterY = label.y + yOffAlign;

console.log("text (w,h) = (" + textWidth + ", " + textHeight + ")");

let rectTop = textCenterX - (rectWidth / 2);
let rectLeft = textCenterY - (rectHeight / 2);

console.log("rect (x,y,w,h) = (" + rectTop + ", " + rectLeft + ", " + rectWidth + ", " + rectHeight + ")");

ctx.fillStyle = rectFill;
ctx.strokeStyle = rectStroke;

Expand Down
9 changes: 2 additions & 7 deletions dist/uPlot.iife.js
Original file line number Diff line number Diff line change
Expand Up @@ -3193,6 +3193,8 @@ var uPlot = (function () {
s.pxAlign = +ifNull(s.pxAlign, pxAlign);
s.pxRound = pxRoundGen(s.pxAlign);

// need a better way to know what path function we are using
// want the defults for eventMarkersPath to be different
if (s.paths.toString() == eventMarkersPath.toString())
{
s.auto = false;
Expand Down Expand Up @@ -3730,7 +3732,6 @@ var uPlot = (function () {
setFontStyle(ctx.font, textFill, "center", "center");

labels.forEach((label) => {

let text = ctx.measureText(label.text);

let textWidth = text.width;
Expand All @@ -3750,18 +3751,12 @@ var uPlot = (function () {
yOffAlign = -(text.actualBoundingBoxDescent + rectPadding);
}

console.log("text yOffAlign = " + yOffAlign);

let textCenterX = label.x;
let textCenterY = label.y + yOffAlign;

console.log("text (w,h) = (" + textWidth + ", " + textHeight + ")");

let rectTop = textCenterX - (rectWidth / 2);
let rectLeft = textCenterY - (rectHeight / 2);

console.log("rect (x,y,w,h) = (" + rectTop + ", " + rectLeft + ", " + rectWidth + ", " + rectHeight + ")");

ctx.fillStyle = rectFill;
ctx.strokeStyle = rectStroke;

Expand Down
2 changes: 1 addition & 1 deletion dist/uPlot.iife.min.js

Large diffs are not rendered by default.

226 changes: 0 additions & 226 deletions package-lock.json

This file was deleted.

9 changes: 2 additions & 7 deletions src/uPlot.js
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,8 @@ export default function uPlot(opts, data, then) {
s.pxAlign = +ifNull(s.pxAlign, pxAlign);
s.pxRound = pxRoundGen(s.pxAlign);

// need a better way to know what path function we are using
// want the defults for eventMarkersPath to be different
if (s.paths.toString() == eventMarkersPath.toString())
{
s.auto = false;
Expand Down Expand Up @@ -1431,7 +1433,6 @@ export default function uPlot(opts, data, then) {
setFontStyle(ctx.font, textFill, "center", "center");

labels.forEach((label) => {

let text = ctx.measureText(label.text);

let textWidth = text.width;
Expand All @@ -1451,18 +1452,12 @@ export default function uPlot(opts, data, then) {
yOffAlign = -(text.actualBoundingBoxDescent + rectPadding);
}

console.log("text yOffAlign = " + yOffAlign);

let textCenterX = label.x;
let textCenterY = label.y + yOffAlign;

console.log("text (w,h) = (" + textWidth + ", " + textHeight + ")");

let rectTop = textCenterX - (rectWidth / 2);
let rectLeft = textCenterY - (rectHeight / 2);

console.log("rect (x,y,w,h) = (" + rectTop + ", " + rectLeft + ", " + rectWidth + ", " + rectHeight + ")");

ctx.fillStyle = rectFill;
ctx.strokeStyle = rectStroke;

Expand Down