Merge commit '9f68f1ac5f7e8eb7a089d13b27d44fa0702d7931'
This commit is contained in:
commit
4dabb9d577
1
.gitignore
vendored
1
.gitignore
vendored
@ -62,6 +62,7 @@ typings/
|
|||||||
|
|
||||||
# npm build output
|
# npm build output
|
||||||
dist
|
dist
|
||||||
|
docs
|
||||||
docs/assets/
|
docs/assets/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
2
docs/assets/js/frappe-charts.min.js
vendored
2
docs/assets/js/frappe-charts.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,12 @@ import {
|
|||||||
getSplineCurvePointsStr,
|
getSplineCurvePointsStr,
|
||||||
} from "./draw-utils";
|
} from "./draw-utils";
|
||||||
import { getStringWidth, isValidNumber, round } from "./helpers";
|
import { getStringWidth, isValidNumber, round } from "./helpers";
|
||||||
import { DOT_OVERLAY_SIZE_INCR } from "./constants";
|
|
||||||
|
import {
|
||||||
|
DOT_OVERLAY_SIZE_INCR,
|
||||||
|
PERCENTAGE_BAR_DEFAULT_DEPTH,
|
||||||
|
} from "./constants";
|
||||||
|
import { lightenDarkenColor } from "./colors";
|
||||||
|
|
||||||
export const AXIS_TICK_LENGTH = 6;
|
export const AXIS_TICK_LENGTH = 6;
|
||||||
const LABEL_MARGIN = 4;
|
const LABEL_MARGIN = 4;
|
||||||
@ -379,7 +384,8 @@ export function legendDot(
|
|||||||
export function makeText(className, x, y, content, options = {}) {
|
export function makeText(className, x, y, content, options = {}) {
|
||||||
let fontSize = options.fontSize || FONT_SIZE;
|
let fontSize = options.fontSize || FONT_SIZE;
|
||||||
let dy = options.dy !== undefined ? options.dy : fontSize / 2;
|
let dy = options.dy !== undefined ? options.dy : fontSize / 2;
|
||||||
let fill = options.fill || "var(--charts-label-color)";
|
//let fill = options.fill || "var(--charts-label-color)";
|
||||||
|
let fill = options.fill || FONT_FILL;
|
||||||
let textAnchor = options.textAnchor || "start";
|
let textAnchor = options.textAnchor || "start";
|
||||||
return createSVG("text", {
|
return createSVG("text", {
|
||||||
className: className,
|
className: className,
|
||||||
@ -394,6 +400,7 @@ export function makeText(className, x, y, content, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function makeVertLine(x, label, y1, y2, options = {}) {
|
function makeVertLine(x, label, y1, y2, options = {}) {
|
||||||
|
if (!options.stroke) options.stroke = BASE_LINE_COLOR;
|
||||||
let l = createSVG("line", {
|
let l = createSVG("line", {
|
||||||
className: "line-vertical " + options.className,
|
className: "line-vertical " + options.className,
|
||||||
x1: 0,
|
x1: 0,
|
||||||
@ -448,8 +455,8 @@ function makeHoriLine(y, label, x1, x2, options = {}) {
|
|||||||
|
|
||||||
let l = createSVG("line", {
|
let l = createSVG("line", {
|
||||||
className: className,
|
className: className,
|
||||||
x1: x1,
|
x1: lineX1Post,
|
||||||
x2: x2,
|
x2: lineX2Post,
|
||||||
y1: 0,
|
y1: 0,
|
||||||
y2: 0,
|
y2: 0,
|
||||||
styles: {
|
styles: {
|
||||||
@ -458,7 +465,7 @@ function makeHoriLine(y, label, x1, x2, options = {}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let text = createSVG("text", {
|
let text = createSVG("text", {
|
||||||
x: x1 < x2 ? x1 - LABEL_MARGIN : x1 + LABEL_MARGIN,
|
x: textXPos,
|
||||||
y: 0,
|
y: 0,
|
||||||
dy: FONT_SIZE / 2 - 2 + "px",
|
dy: FONT_SIZE / 2 - 2 + "px",
|
||||||
"font-size": FONT_SIZE + "px",
|
"font-size": FONT_SIZE + "px",
|
||||||
@ -539,7 +546,7 @@ export function yLine(y, label, width, options = {}) {
|
|||||||
x2 = width;
|
x2 = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// let offset = options.pos === 'left' ? -1 * options.offset : options.offset;
|
let offset = options.pos === "left" ? -1 * options.offset : options.offset;
|
||||||
|
|
||||||
// pr_366
|
// pr_366
|
||||||
//x1 += offset;
|
//x1 += offset;
|
||||||
@ -565,6 +572,7 @@ export function xLine(x, label, height, options = {}) {
|
|||||||
if (!options.pos) options.pos = "bottom";
|
if (!options.pos) options.pos = "bottom";
|
||||||
if (!options.offset) options.offset = 0;
|
if (!options.offset) options.offset = 0;
|
||||||
if (!options.mode) options.mode = "span";
|
if (!options.mode) options.mode = "span";
|
||||||
|
if (!options.stroke) options.stroke = BASE_LINE_COLOR;
|
||||||
if (!options.className) options.className = "";
|
if (!options.className) options.className = "";
|
||||||
|
|
||||||
// Draw X axis line in span/tick mode with optional label
|
// Draw X axis line in span/tick mode with optional label
|
||||||
@ -588,6 +596,7 @@ export function xLine(x, label, height, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return makeVertLine(x, label, y1, y2, {
|
return makeVertLine(x, label, y1, y2, {
|
||||||
|
stroke: options.stroke,
|
||||||
className: options.className,
|
className: options.className,
|
||||||
lineType: options.lineType,
|
lineType: options.lineType,
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user