K线图配置1(蜡烛图) - Shaman05/wxCharts GitHub Wiki

K线图配置1(蜡烛图):

return {
    name: 'dk',
    width: 'auto',
    height: 160,
    average: [5, 10, 20],  //均线设置
    axis: {
        row: 4,
        col: 5,
        showX: false,    //不显示垂直线坐标
        paddingTop: 0,
        paddingBottom: 0,
        paddingLeft: 0,
        paddingRight: 0,
        color: '#cdcdcd'
    },
    xAxis: {
        data: []    //时间(不会显示)
    },
    yAxis: [
        {
            type: 'candle',  //蜡烛图
            gap: 0,  //间隔
            data_h: [],  //最高
            data_l: [],  //最低
            data_s: [],  //开盘
            data_c: [],  //收盘(现价)
            yin_yang: [] //阴阳: true为阳,false为阴
        },
        {
            name: 'MA' + val,  //均线名称
            type: 'line',
            lineColor: averageColors[index],  //颜色
            data: [],   //数据
        },
        {...}    //根据上面的 average: [5, 10, 20] 的配置, 从yAxis[1]~yAxis[3]开始分别为五日/十日/二十日均线
    ],
    callback: function (time) {    //回调
        var page = getCurrentPages();
        page = page[page.length - 1];
        page.setData({
            kl1RenderTime: time
        });
    }
};