jones2000 / HQChart

HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据替换接口
https://jones2000.github.io/HQChart/webhqchart.demo/samples/kline_index_edit.html
Apache License 2.0
2.89k stars 745 forks source link

大佬,别忽略掉VUE和VUE 3 用户,什么时候demo也能更新到VUE 3 #129

Closed manyhelp closed 2 years ago

jones2000 commented 2 years ago

HQChart使用教程73-使用Vue3.0创建HQChart图形

sorcerer310 commented 11 months ago

参照了例子在 vue3 里写了个demo,但无论如何调试NetworkFilter都不执行,请问现在 vue3 的 demo 有问题吗?

`

`
jones2000 commented 11 months ago

教程文档中的示例源码已更新

import HQData from "hqchart/lib/umychart.NetworkFilterTest.vue"

....................................
 const KLineNetworkFilter=function(data, callback)
{
   HQData.HQData.NetworkFilter(data, callback);
}

const MinuteNetworkFilter=function(data, callback)
{
    HQData.HQData.NetworkFilter(data, callback);
}

//创建走势图
const CreateKLineChart=function(period)
{
    ClearChart();

    var option=DefaultData.GetKLineOption();
    option.Symbol=HQChartData.Symbol;
    option.Period=period;

    var divKLine=document.getElementById('kline');
    var chart=HQChart.Chart.JSChart.Init(divKLine);
    option.NetworkFilter=(data, callback)=>{ KLineNetworkFilter(data, callback); }
    chart.SetOption(option);
    HQChartData.Chart=chart;
};

.................................

 //创建分时图
const CreateMinuteChart=function()
{
    ClearChart();

    var option=DefaultData.GetMinuteOption();
    option.Symbol=HQChartData.Symbol;

    var divKLine=document.getElementById('kline');
    var chart=HQChart.Chart.JSChart.Init(divKLine);
    option.NetworkFilter=(data, callback)=>{ MinuteNetworkFilter(data, callback); }
    chart.SetOption(option);
    HQChartData.Chart=chart;
};
sorcerer310 commented 11 months ago

参照您的代码修改了一下,但还是原来的问题 option.NetworkFilter=(data, callback)=>{ KLineNetworkFilter(data, callback); } 中,KLineNetworkFilter(data,callback)函数没有执行,也就是说option.NetworkFilter没有被框架调用, HQChart框架中option.NetworkFilter什么时候会被调用?

jones2000 commented 11 months ago

我这里用vue3的框架,是可以被调用的。在setoption就之后就会被调用。 image