Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@meta2d/le5le-charts

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meta2d/le5le-charts - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

2

package.json
{
"name": "@meta2d/le5le-charts",
"version": "1.0.3",
"version": "1.0.4",
"description": "The le5le-charts library based on le5le meta2d.",

@@ -5,0 +5,0 @@ "main": "index.js",

/// <reference types="node" />
import { Pen } from '../../core/src/pen';
interface Axis {
lineStyle?: {};
axisLabel?: {
fontSize?: number;
fontColor?: string;
fontStyle?: string;
textDecoration?: string;
fontWeight?: string;
fontFamily?: string;
lineHeight?: number;
};
}
export declare function getValidValue(num: any, value: number): any;

@@ -19,2 +31,26 @@ export declare enum ReplaceMode {

};
tickLabel?: {
show?: boolean;
labelLine?: {
show?: boolean;
};
color?: string;
fontSize?: number;
fontFamily?: string;
fontWeight?: string;
lineHeight?: number;
fontStyle?: string;
textDecoration?: string;
};
titleLabel?: {
fontSize?: number;
fontFamily?: string;
fontWeight?: string;
lineHeight?: number;
fontStyle?: string;
textDecoration?: string;
color?: string;
};
xAxis?: Axis;
yAxis?: Axis;
startAngle?: number;

@@ -41,1 +77,2 @@ endAngle?: number;

}
export {};
import { scaleCompute } from './normalizedAxis';
import { getFont } from "@meta2d/core";
//用于绘制坐标轴
export function coordinateAxis(ctx, pen) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
var x = pen.calculative.worldRect.x;

@@ -56,2 +58,11 @@ var y = pen.calculative.worldRect.y;

ctx.setLineDash([2, 2]);
var fontOptions = {
fontStyle: ((_b = (_a = pen.yAxis) === null || _a === void 0 ? void 0 : _a.axisLabel) === null || _b === void 0 ? void 0 : _b.fontStyle) || pen.fontStyle,
textDecoration: (_d = (_c = pen.yAxis) === null || _c === void 0 ? void 0 : _c.axisLabel) === null || _d === void 0 ? void 0 : _d.textDecoration,
fontWeight: ((_f = (_e = pen.yAxis) === null || _e === void 0 ? void 0 : _e.axisLabel) === null || _f === void 0 ? void 0 : _f.fontWeight) || pen.fontWeight,
fontFamily: ((_h = (_g = pen.yAxis) === null || _g === void 0 ? void 0 : _g.axisLabel) === null || _h === void 0 ? void 0 : _h.fontFamily) || pen.fontFamily,
fontSize: ((_k = (_j = pen.yAxis) === null || _j === void 0 ? void 0 : _j.axisLabel) === null || _k === void 0 ? void 0 : _k.fontSize) || pen.fontSize,
lineHeight: ((_m = (_l = pen.yAxis) === null || _l === void 0 ? void 0 : _l.axisLabel) === null || _m === void 0 ? void 0 : _m.lineHeight) || pen.lineHeight,
};
ctx.fillStyle = ((_p = (_o = pen.yAxis) === null || _o === void 0 ? void 0 : _o.axisLabel) === null || _p === void 0 ? void 0 : _p.fontColor) || pen.color;
for (var i = 0; i < normalizedOption.splitNumber + 1; i++) {

@@ -61,6 +72,7 @@ var temH = (i * h) / normalizedOption.splitNumber;

ctx.textBaseline = 'middle';
ctx.font = r / 10 + 'px AlibabaPuHuiTi-Regular, Alibaba PuHuiTi';
ctx.font = getFont(fontOptions); //r / 10 +'px AlibabaPuHuiTi-Regular, Alibaba PuHuiTi';
ctx.fillText(normalizedOption.max - i * normalizedOption.interval + '', x - 10 * scale, y + temH);
ctx.fill();
if (i < normalizedOption.splitNumber) {
ctx.beginPath();
ctx.moveTo(x, y + temH);

@@ -81,3 +93,12 @@ ctx.lineTo(x + w, y + temH);

ctx.textBaseline = 'top';
ctx.font = r / 10 + 'px AlibabaPuHuiTi-Regular, Alibaba PuHuiTi';
var fontOptions_1 = {
fontStyle: ((_r = (_q = pen.xAxis) === null || _q === void 0 ? void 0 : _q.axisLabel) === null || _r === void 0 ? void 0 : _r.fontStyle) || pen.calculative.fontStyle,
textDecoration: (_t = (_s = pen.xAxis) === null || _s === void 0 ? void 0 : _s.axisLabel) === null || _t === void 0 ? void 0 : _t.textDecoration,
fontWeight: ((_v = (_u = pen.xAxis) === null || _u === void 0 ? void 0 : _u.axisLabel) === null || _v === void 0 ? void 0 : _v.fontWeight) || pen.calculative.fontWeight,
fontFamily: ((_x = (_w = pen.xAxis) === null || _w === void 0 ? void 0 : _w.axisLabel) === null || _x === void 0 ? void 0 : _x.fontFamily) || pen.calculative.fontFamily,
fontSize: ((_z = (_y = pen.xAxis) === null || _y === void 0 ? void 0 : _y.axisLabel) === null || _z === void 0 ? void 0 : _z.fontSize) || pen.calculative.fontSize,
lineHeight: ((_1 = (_0 = pen.xAxis) === null || _0 === void 0 ? void 0 : _0.axisLabel) === null || _1 === void 0 ? void 0 : _1.lineHeight) || pen.calculative.lineHeight,
};
ctx.font = getFont(fontOptions_1); //r / 10 +'px AlibabaPuHuiTi-Regular, Alibaba PuHuiTi';
ctx.fillStyle = ((_3 = (_2 = pen.xAxis) === null || _2 === void 0 ? void 0 : _2.axisLabel) === null || _3 === void 0 ? void 0 : _3.fontColor) || pen.calculative.color;
ctx.fillText(xData[i], xdataX, (y + h + 10 * scale));

@@ -84,0 +105,0 @@ ctx.fill();

@@ -13,4 +13,6 @@ var __assign = (this && this.__assign) || function () {

import { getValidValue } from './common';
import { getFont } from "@meta2d/core";
//仪表全盘
export function gauge(ctx, pen) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
if (!pen.onAdd) {

@@ -122,10 +124,11 @@ pen.onAdd = onAdd;

var interval = valueGap / pen.splitNumber;
ctx.font =
(pen.calculative.fontStyle || '') +
' normal ' +
(pen.calculative.fontWeight || '') +
' ' +
r / 10 +
'px ' +
pen.calculative.fontFamily;
var fontOption = {
fontStyle: ((_a = pen.tickLabel) === null || _a === void 0 ? void 0 : _a.fontStyle) || pen.calculative.fontStyle,
textDecoration: ((_b = pen.tickLabel) === null || _b === void 0 ? void 0 : _b.textDecoration) || pen.textDecoration,
fontWeight: ((_c = pen.tickLabel) === null || _c === void 0 ? void 0 : _c.fontWeight) || pen.calculative.fontWeight,
fontFamily: ((_d = pen.tickLabel) === null || _d === void 0 ? void 0 : _d.fontFamily) || pen.calculative.fontFamily,
fontSize: (((_e = pen.tickLabel) === null || _e === void 0 ? void 0 : _e.fontSize) || pen.calculative.fontSize) * scale,
lineHeight: ((_f = pen.tickLabel) === null || _f === void 0 ? void 0 : _f.lineHeight) || pen.calculative.lineHeight,
};
ctx.font = getFont(fontOption);
var textR = r - bgLineWidth - r / 20;

@@ -141,3 +144,3 @@ for (var i = 0; i <= pen.splitNumber; i++) {

var height = Math.sin((angle / 180) * Math.PI);
ctx.fillStyle = '#999999';
ctx.fillStyle = ((_g = pen.tickLabel) === null || _g === void 0 ? void 0 : _g.color) || '#999999';
if (width > 0.02) {

@@ -223,11 +226,12 @@ ctx.textAlign = 'end';

ctx.textBaseline = 'middle';
ctx.font =
(pen.calculative.fontStyle || '') +
' normal ' +
(pen.calculative.fontWeight || '') +
' ' +
r / 5 +
'px ' +
pen.calculative.fontFamily;
ctx.fillStyle = pointColor;
var titleOption = {
fontStyle: ((_h = pen.titleLabel) === null || _h === void 0 ? void 0 : _h.fontStyle) || pen.calculative.fontStyle,
textDecoration: ((_j = pen.titleLabel) === null || _j === void 0 ? void 0 : _j.textDecoration) || pen.textDecoration,
fontWeight: ((_k = pen.titleLabel) === null || _k === void 0 ? void 0 : _k.fontWeight) || pen.calculative.fontWeight,
fontFamily: ((_l = pen.titleLabel) === null || _l === void 0 ? void 0 : _l.fontFamily) || pen.calculative.fontFamily,
fontSize: (((_m = pen.titleLabel) === null || _m === void 0 ? void 0 : _m.fontSize) || pen.calculative.fontSize) * scale,
lineHeight: ((_o = pen.titleLabel) === null || _o === void 0 ? void 0 : _o.lineHeight) || pen.calculative.lineHeight,
};
ctx.font = getFont(titleOption);
ctx.fillStyle = ((_p = pen.titleLabel) === null || _p === void 0 ? void 0 : _p.color) || pointColor;
if (pen.isClock) {

@@ -234,0 +238,0 @@ ctx.fillText(('0' + parseInt(pen.hourvalue)).slice(-2) +

@@ -27,2 +27,3 @@ var __read = (this && this.__read) || function (o, n) {

import { ReplaceMode } from './common';
import { getFont } from "@meta2d/core";
//饼状图

@@ -127,3 +128,3 @@ export function pieChart(ctx, pen) {

data.forEach(function (item, index) {
var _a;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
afterAngle += (Math.PI * 2 * item.value) / sum;

@@ -172,3 +173,10 @@ ctx.beginPath();

}
ctx.font = r / 10 + 'px AlibabaPuHuiTi-Regular, Alibaba PuHuiTi';
var fontOption = {
fontStyle: ((_a = pen.tickLabel) === null || _a === void 0 ? void 0 : _a.fontStyle) || pen.calculative.fontStyle,
fontWeight: ((_b = pen.tickLabel) === null || _b === void 0 ? void 0 : _b.fontWeight) || pen.calculative.fontWeight,
fontFamily: ((_c = pen.tickLabel) === null || _c === void 0 ? void 0 : _c.fontFamily) || pen.calculative.fontFamily,
lineHeight: ((_d = pen.tickLabel) === null || _d === void 0 ? void 0 : _d.lineHeight) || pen.calculative.lineHeight,
fontSize: (((_e = pen.tickLabel) === null || _e === void 0 ? void 0 : _e.fontSize) || pen.calculative.fontSize) * scale
};
ctx.font = getFont(fontOption); // r / 10 + 'px AlibabaPuHuiTi-Regular, Alibaba PuHuiTi';
ctx.textBaseline = 'middle';

@@ -181,6 +189,6 @@ ctx.textAlign = 'center';

}
if ((isEcharts && series.labelLine.show !== false) || !isEcharts) {
if ((isEcharts && series.labelLine.show !== false) || (!isEcharts && ((_h = (_g = (_f = pen.tickLabel) === null || _f === void 0 ? void 0 : _f.labelLine) === null || _g === void 0 ? void 0 : _g.show) !== null && _h !== void 0 ? _h : true))) {
ctx.lineTo(temX - 5 * scale, temY);
}
if ((isEcharts && series.label.show !== false) || !isEcharts) {
if ((isEcharts && series.label.show !== false) || (!isEcharts && ((_k = (_j = pen.tickLabel) === null || _j === void 0 ? void 0 : _j.show) !== null && _k !== void 0 ? _k : true))) {
ctx.fillText(item.name, temX - 5 * scale, temY);

@@ -196,3 +204,3 @@ }

}
if ((isEcharts && series.label.show !== false) || !isEcharts) {
if ((isEcharts && series.label.show !== false) || (!isEcharts && ((_m = (_l = pen.tickLabel) === null || _l === void 0 ? void 0 : _l.show) !== null && _m !== void 0 ? _m : true))) {
ctx.fillText(item.name, temX + 5 * scale, temY);

@@ -205,3 +213,3 @@ }

ctx.strokeStyle = isEcharts
? ((_a = series.itemStyle) === null || _a === void 0 ? void 0 : _a.borderColor) || '#fff'
? ((_o = series.itemStyle) === null || _o === void 0 ? void 0 : _o.borderColor) || '#fff'
: '#fff';

@@ -208,0 +216,0 @@ beforeAngle = afterAngle;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc