steam-family-bot-core
Version:
一个用于新版 Steam 家庭的库存监控 Bot 插件
63 lines • 2.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
/** @jsxImportSource react */
const playtimeGraph_1 = require("./playtimeGraph");
const lodash_1 = require("lodash");
const renderChart_1 = require("../renderChart");
function EchartWordCloud({ width, height, words, className, }) {
const data = words.map((it) => ({
name: it.text,
value: it.value,
}));
const option = {
tooltip: {
show: true,
formatter: '{b}: {c}',
},
series: [
{
type: 'wordCloud',
shape: 'square',
keepAspect: false,
left: 'center',
top: 'center',
width: '100%',
height: '100%',
right: null,
bottom: null,
// Text size range which the value in data will be mapped to.
// Default to have minimum 12px and maximum 60px size.
sizeRange: [14, 84],
rotationRange: [0, 0],
rotationStep: 14,
// size of the grid in pixels for marking the availability of the canvas
// the larger the grid size, the bigger the gap between words.
gridSize: 8,
// set to true to allow word being draw partly outside of the canvas.
// Allow word bigger than the size of the canvas to be drawn
drawOutOfBound: false,
shrinkToFit: false,
textStyle: {
fontFamily: 'sans-serif',
fontWeight: 'normal',
// Color can be a callback function or a color string
color: function () {
const idx = (0, lodash_1.random)(playtimeGraph_1.selectableColor.length - 1, false);
return playtimeGraph_1.selectableColor[idx];
},
},
data: data,
},
],
};
const res = (0, renderChart_1.renderCanvasChart)(option, {
height: height,
width: width,
});
return ((0, jsx_runtime_1.jsx)("div", { className: className, dangerouslySetInnerHTML: {
__html: res,
} }));
}
exports.default = EchartWordCloud;
//# sourceMappingURL=echart-wordcloud.js.map