wujingjing
2024-07-16 015898efa6b1149cbb79fb2b2898ea6b13c20d2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
export const timeDataOptionToContent = (opt) => {
    const headerList = [opt.xAxis[0]]
        .concat(opt.yAxis)
        .map((item) => `<td>${item.name}</td>`)
        .join('');
    const title = opt.title?.[0]?.text ?? '';
    let table =
        '<div style="border:1px solid black"><h3>' +
        title +
        '</h3><table style="width:100%;text-align:center"><tbody><tr>' +
        headerList +
        '</tr>';
    const timeData = new Set();
    const dataMap = opt.series.map((item) => {
        for (const subItem of item.data) {
            timeData.add(subItem[0]);
        }
        return new Map(item.data);
    });
    const bodyList = Array.from(timeData)
        .toSorted((a, b) => {
            return (a as any).localeCompare(b);
        })
        .map((item) => {
            return `<tr><td>${item}</td>${dataMap.map((itemMap) => `<td>${itemMap.get(item) ?? ''}</td>`)}</tr>`;
        })
        .join('');
    table += bodyList;
 
    table += '</tbody></table></div>';
    return table;
};
 
export const PATH_ICON = {
    scatter:
        'path://M445.7 609.8c0 19.4 10.3 37.3 27.1 46.9 16.8 9.7 37.4 9.7 54.2 0 16.8-9.7 27.1-27.6 27.1-46.9 0-29.9-24.3-54.2-54.2-54.2s-54.2 24.3-54.2 54.2z m0 0M179.2 613.8c-42.2 0-76.5 34.3-76.5 76.5s34.3 76.5 76.5 76.5 76.5-34.3 76.5-76.5-34.3-76.5-76.5-76.5z m0 0M144.9 401.1c0 29 23.5 52.5 52.5 52.5s52.5-23.5 52.5-52.5-23.5-52.5-52.5-52.5-52.5 23.5-52.5 52.5z m0 0M598.7 404c0 42.2 34.3 76.5 76.5 76.5 42.3 0 76.5-34.3 76.5-76.5 0-42.3-34.3-76.5-76.5-76.5-42.3 0-76.5 34.3-76.5 76.5z m0 0M849.3 169.2c-42.2 0-76.5 34.3-76.5 76.5s34.3 76.5 76.5 76.5 76.5-34.3 76.5-76.5-34.3-76.5-76.5-76.5z m0 0M261.6 583.1c0 13.2 7.1 25.5 18.5 32.1 11.5 6.6 25.6 6.6 37.1 0s18.5-18.9 18.5-32.1c0-20.5-16.6-37.1-37.1-37.1-20.4 0.1-37 16.7-37 37.1z m0 0M276.8 425.1c0 42.3 34.3 76.5 76.5 76.5 42.3 0 76.5-34.3 76.5-76.5s-34.3-76.5-76.5-76.5-76.5 34.3-76.5 76.5z m0 0M445.7 421.4c0 18.5 9.9 35.5 25.8 44.8 16 9.2 35.7 9.2 51.7 0s25.8-26.3 25.8-44.8c0-28.5-23.1-51.7-51.7-51.7-28.5 0-51.6 23.2-51.6 51.7z m0 0M398.2 208.8c0 42.3 34.3 76.5 76.5 76.5s76.5-34.3 76.5-76.5c0-42.3-34.3-76.5-76.5-76.5s-76.5 34.3-76.5 76.5z m0 0M693.7 599.2c0 42.3 34.3 76.5 76.5 76.5s76.5-34.3 76.5-76.5-34.3-76.5-76.5-76.5c-42.3 0-76.5 34.3-76.5 76.5z m0 0M62.1 828.9H959v60.7H62.1z',
    bar: 'path://M580.8 228.8h-136v500.8h136V228.8z m-40 460.8h-56V268.8h56v420.8zM788.8 420.8h-136v308.8h136V420.8z m-40 268.8h-56V460.8h56v228.8zM372.8 326.4h-136v401.6h136V326.4z m-40 363.2h-56V366.4h56v323.2zM208 788.8h608v40H208z',
 
    line:'path://M1007.983701 110.874633c0-52.132765-42.296642-94.429407-94.429407-94.429407s-94.4284 42.296642-94.4284 94.429407c0 31.415385 15.491719 59.048963 39.099826 76.170806L720.086025 646.403197c-12.542593 0.613185-24.346143 3.627757-35.104561 8.606734L371.263584 335.728082c4.61147-11.065513 7.193087-23.207372 7.193087-35.994635 0-52.131759-42.295635-94.429407-94.4284-94.429407-52.132765 0-94.429407 42.297648-94.429407 94.429407 0 30.523298 14.692263 57.35742 37.1324 74.604115L90.189473 835.321416c-49.796824 2.643037-89.449422 43.528045-89.449422 93.937047 0 52.132765 42.295635 94.430414 94.429407 94.430414 52.132765 0 94.4284-42.297648 94.4284-94.430414 0-31.413372-15.491719-58.955324-39.0374-76.168793l136.049431-459.172494c15.368881-0.461147 29.569791-4.673896 42.235222-11.527667l311.2591 316.82307c-6.147955 12.480167-9.836124 26.311556-9.836124 41.191097 0 52.129745 42.295635 94.427393 94.4284 94.427393 52.131759 0 94.4284-42.297648 94.4284-94.427393 0-31.294561-15.369887-58.713675-38.791723-75.924123l138.201115-459.66586C968.331103 202.16965 1007.983701 161.286655 1007.983701 110.874633z'
};
 
export const SCATTER_SYMBOL_SIZE = 4