0.0.7 • Published 2 years ago

wind-profile v0.0.7

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

WindProfile

1. 使用方式

import { WindProfileSvg, demoData } from 'WindProfileSvg'
const options = { 
    overlay: true, 
    tooltip: { show: true }, 
    styleConfig: 
    { 
        backgroundColor: '#fff', 
        color: '#000',
        tooltip: {
            fontSize: 14,
            color: 'orange',
            background: 'rgba(0, 0, 0, 0.8)'
        }
    } 
};
const boxModel = { width: 1200, height: 600, margin: {
    top: 30, 
    left: 60, 
    bottom: 30, 
    right: 80
} };

const windProfileSvg = new WindProfileSvg(demoData, options, boxModel);
document.querySelector('#app').append(windProfileSvg.containerElement);

2. 数据结构 data

[{
        "station": "xxxx",
        "stationId": "YW0001",
        "time": "20210520175420",
        "gv": "0.00",
        "gd": "78.77",
        "gt": "0.00",
        "gh": "0.00",
        "metricList": [
            {
                "hei": "0",
                "vh": "0.00",
                "dir": "0.00",
                "vv": "0.00",
                "cn2": "0.00e+00",
                "chop": "0.0137"
            },
            {
                "hei": "100",
                "vh": "1.37",
                "dir": "9.63",
                "vv": "0.15",
                "cn2": "4.84e-12",
                "chop": "0.0109"
            },
            ...
            {
                "hei": "5300",
                "vh": "0.50",
                "dir": "122.47",
                "vv": "-4.76",
                "cn2": "4.86e-09",
                "chop": "0.0000"
            }
        ],
        "dateFormat": "YYYYMMDDHHmmss",
        "groundTime": "2021-05-20 17:54:20"
    }]

3. 配置内容

参数名类型默认值描述例子
overlaybooleanfalse是否叠加cn2、风切变--
overlayTypenumber11叠加产品的类型 (0 风羽图,1 垂直气流, 2 CN2, 11 风切变)--
windValueFunctionfunctionundefined回调函数映射风羽图风矢图Path路径对应索引(item)=> { return +item.vh0; }
windValueFunctionfunctionundefined回调函数映射cn2、风切变色卡对应索引(item)=> { return +item.cn2 * 1e100;}
altitudeListLabelstringmetricList对应数据中metricList字段,可根据自定义数据结构修改--
altitudeLabelstringhei对应数据中metricList数组内hei字段,可根据自定义数据结构修改--
timeStampLabelstringtimeStamp对应数据中timeStamp字段,可根据自定义数据结构修改--
directionLabelstringdir对应数据中metricList数组内dir字段,可根据自定义数据结构修改--
tooltip.showbooleanfalse是否显示tooltip--
windColorsArray'#00ff00', '#00ff00', '#00ff00', '#00ff00','#0000ff', '#0000ff', '#0000ff', '#ff00ff', '#ff00ff', '#ff00ff', '#ff00ff', '#ff00ff', '#ff00ff', '#ff00ff', '#ff00ff', '#ff0000', '#ff0000', '#ff0000', '#ff0000'风羽图、风矢图色卡--
rectColorsArray'#FFF', '#C7FFC7', '#94FF93', '#5DFF5D', '#26FF26', '#0CF219', '#43BB86', '#7A84F4', '#9780E7', '#B180CD', '#CD80B1', '#E78097', '#FF8080'叠加图色卡--
windPathsArraysvg path2D 数组风羽路径--
styleConfigObject--styleConfig--

styleConfig

参数名默认值描述
backgroundColor#0b1f21画布背景颜色
fontSize12全局字号
colorwhite全局字体颜色
tooltip.fontSize12tooltip字号
tooltip.colorwhitetooltip字体颜色
tooltip.backgroundrgba(0, 0, 0, 0.8)tooltip背景颜色

4. boxModel 盒子模型

参数名默认值描述
width1200盒子宽度
height600盒子高度
margin.top30盒子marginTop
margin.right80盒子marginRight
margin.bottom30盒子marginBottom
margin.left60盒子marginLeft