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

@meta2d/chart-diagram

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meta2d/chart-diagram - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "@meta2d/chart-diagram",
"version": "1.0.4",
"version": "1.0.5",
"description": "The charting library based on le5le meta2d and echarts/highcharts.",

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

@@ -15,2 +15,5 @@ import { BindId, Pen } from '@meta2d/core';

timeFormat: string;
geoName?: string;
geoJson?: any;
geoUrl?: string;
};

@@ -17,0 +20,0 @@ beforeScale: number;

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

document.body.appendChild(div);
// 2. 加载到div layer
(_a = pen.calculative.canvas.externalElements) === null || _a === void 0 ? void 0 : _a.parentElement.appendChild(div);
setElemPosition(pen, div);
// 3. 解析echarts数据
pen.calculative.singleton.div = div;
pen.calculative.singleton.echart = echarts.init(div, pen.echarts.theme);
// 3. 生产预览图
// 初始化时,等待父div先渲染完成,避免初始图表控件太大。
setTimeout(function () {
pen.calculative.singleton.echart.setOption(pen.echarts.option, true);
pen.calculative.singleton.echart.resize();
setTimeout(function () {
var img = new Image();
img.src = pen.calculative.singleton.echart.getDataURL({
pixelRatio: 2,
pen.calculative.singleton.echartsReady = true;
if (pen.echarts.geoName && !echarts.getMap(pen.echarts.geoName)) {
if (pen.echarts.geoJson) {
echarts.registerMap(pen.echarts.geoName, pen.echarts.geoJson);
}
else if (pen.echarts.geoUrl) {
pen.calculative.singleton.echartsReady = false;
fetch(pen.echarts.geoUrl).then(function (e) {
e.text().then(function (data) {
if (typeof data === 'string') {
try {
data = JSON.parse(data);
}
catch (_a) { }
}
if (data.constructor !== Object && data.constructor !== Array) {
console.warn('Invalid data:', data);
return;
}
echarts.registerMap(pen.echarts.geoName, data);
pen.calculative.singleton.echartsReady = true;
pen.calculative.singleton.echart.setOption(pen.echarts.option, true);
setTimeout(function () {
onRenderPenRaw(pen);
}, 300);
});
});
pen.calculative.img = img;
}, 100);
});
// 4. 加载到div layer
// pen.calculative.canvas.externalElements?.appendChild(div);
(_a = pen.calculative.canvas.externalElements) === null || _a === void 0 ? void 0 : _a.parentElement.appendChild(div);
setElemPosition(pen, div);
}
else {
// path.rect(worldRect.x, worldRect.y, worldRect.width, worldRect.height);
if (pen.calculative.patchFlags && pen.calculative.singleton.div) {
setElemPosition(pen, pen.calculative.singleton.div);
}
}
// 4. 加载echarts
if (pen.calculative.singleton.echartsReady) {
// 初始化时,等待父div先渲染完成,避免初始图表控件太大。
setTimeout(function () {
pen.calculative.singleton.echart.setOption(pen.echarts.option, true);
setTimeout(function () { return onRenderPenRaw(pen); }, 300);
});
}
}

@@ -132,51 +150,3 @@ return path;

}
var change = false;
var ratio = pen.calculative.canvas.store.data.scale / pen.beforeScale;
/*
if (option.textStyle) {
option.textStyle.fontSize *= ratio;
change = true;
}
if (option.title) {
if (Array.isArray(option.title)) {
option.title.forEach((item) => {
item.textStyle && (item.textStyle.fontSize *= ratio);
change = true;
});
} else {
option.title.textStyle && (option.title.textStyle.fontSize *= ratio);
change = true;
}
}
if (option.legend) {
option.legend.textStyle && (option.legend.textStyle.fontSize *= ratio);
}
if (option.tooltip) {
option.tooltip.textStyle && (option.tooltip.textStyle.fontSize *= ratio);
change = true;
}
if (option.xAxis) {
if (Array.isArray(option.xAxis)) {
option.xAxis.forEach((item) => {
item.axisLabel && (item.axisLabel.fontSize *= ratio);
change = true;
});
} else {
option.xAxis.axisLabel && (option.xAxis.axisLabel.fontSize *= ratio);
change = true;
}
}
if (option.yAxis) {
if (Array.isArray(option.yAxis)) {
option.yAxis.forEach((item) => {
item.axisLabel && (item.axisLabel.fontSize *= ratio);
change = true;
});
} else {
option.yAxis.axisLabel && (option.yAxis.axisLabel.fontSize *= ratio);
change = true;
}
}
*/
if (option.grid) {

@@ -225,3 +195,4 @@ var props_1 = ['top', 'bottom', 'left', 'right'];

setElemPosition(pen, pen.calculative.singleton.div);
pen.calculative.singleton.echart.setOption(pen.echarts.option, true);
pen.calculative.singleton.echartsReady &&
pen.calculative.singleton.echart.setOption(pen.echarts.option, true);
}

@@ -431,3 +402,2 @@ function beforeValue(pen, value) {

});
// console.log('单饼图 dataY', JSON.stringify(dataY));
return {

@@ -456,3 +426,2 @@ id: pen.id,

});
// console.log('dataX', JSON.stringify(dataX), 'dataY', JSON.stringify(dataY));
return {

@@ -496,8 +465,2 @@ id: pen.id,

}
// console.log(
// 'series',
// JSON.stringify(series.map((serie) => serie.name)),
// 'dataY',
// JSON.stringify(dataY)
// );
return {

@@ -583,5 +546,5 @@ id: pen.id,

function onRenderPenRaw(pen) {
var _a;
var _a, _b;
var img = new Image();
img.src = (_a = pen.calculative.singleton) === null || _a === void 0 ? void 0 : _a.echart.getDataURL({
img.src = (_b = (_a = pen.calculative.singleton) === null || _a === void 0 ? void 0 : _a.echart) === null || _b === void 0 ? void 0 : _b.getDataURL({
pixelRatio: 2,

@@ -588,0 +551,0 @@ });

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