| | |
| | | </template> |
| | | |
| | | <script> |
| | | let _timers = [] |
| | | import HQChart from "hqchart"; |
| | | import "hqchart/src/jscommon/umychart.resource/css/tools.css"; |
| | | import "hqchart/src/jscommon/umychart.resource/font/iconfont.css"; |
| | |
| | | ], |
| | | SplashTitle: "loading...", |
| | | Symbol: "600015.sh", |
| | | IsAutoUpdate: true, // 是自动更新数据 |
| | | IsAutoUpdate: false, // 是自动更新数据 |
| | | AutoUpdateFrequency: 15000, |
| | | IsApiPeriod: true, |
| | | IsShowRightMenu: false, // 是否显示右键菜单 |
| | |
| | | ID: 5, |
| | | }, |
| | | { |
| | | Name: i18n.t("hjsfz"), |
| | | ID: 6, |
| | | }, |
| | | { |
| | | Name: i18n.t("hj92"), |
| | | ID: 7, |
| | | }, |
| | |
| | | chartType: "kline", |
| | | KLineChart: null, // 图形控件 K线图 |
| | | Chart: null, // 图形控件 分时图 |
| | | timerss: null, |
| | | isShow: false, |
| | | }; |
| | | }, |
| | |
| | | this.init(); |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.timerss) { |
| | | clearInterval(this.timerss); |
| | | } |
| | | this.clearTime(); |
| | | }, |
| | | methods: { |
| | | // 清除所有定时器 |
| | | clearTime() { |
| | | _timers.forEach(id => { |
| | | clearInterval(id); |
| | | clearTimeout(id); |
| | | }); |
| | | _timers = []; |
| | | }, |
| | | init() { |
| | | this.OnSize(); |
| | | this.SetChartStyle(); |
| | |
| | | SetChartStyle() { |
| | | EastMoney.HQData.SetMinuteChartCoordinate(); |
| | | var blackStyle = HQChart.Chart.HQChartStyle.GetStyleConfig( |
| | | HQChart.Chart.STYLE_TYPE_ID.WHITE_ID |
| | | // HQChart.Chart.STYLE_TYPE_ID.WHITE_ID // 白色风格 |
| | | HQChart.Chart.STYLE_TYPE_ID.BLACK_ID // 黑色风格 |
| | | ); // 读取黑色风格配置 |
| | | |
| | | blackStyle.UpBarColor = "#449b54"; //上涨 |
| | |
| | | HQChart.Chart.JSChart.SetStyle(blackStyle); |
| | | }, |
| | | handleClick(tab) { |
| | | this.clearTime(); |
| | | this.KLineChart.ChangePeriod(tab.$attrs.Id); |
| | | }, |
| | | |
| | |
| | | data, |
| | | callback // 第3方数据替换接口 |
| | | ) { |
| | | if (this.timerss) { |
| | | clearInterval(this.timerss); |
| | | this.timerss = null; |
| | | } |
| | | EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data); |
| | | |
| | | this.timeChange(data, callback); |
| | | this.timerss = setInterval(() => { |
| | | |
| | | let timerId = setInterval(() => { |
| | | this.timeChange(data, callback); |
| | | }, 5000); |
| | | }, 2000); |
| | | _timers.push(timerId); |
| | | }, |
| | | timeChange(data, callback) { |
| | | EastMoney.HQData.Log("[HQChartDemo::NetworkFilter] data", data); |
| | |
| | | #hqchart_minute { |
| | | height: 0; |
| | | flex: 1; |
| | | background-color: #fff; |
| | | // background-color: #fff; |
| | | position: relative; |
| | | } |
| | | |
| | | #hqchart_kline { |
| | | height: 0; |
| | | flex: 1; |
| | | background-color: #fff; |
| | | // background-color: #fff; |
| | | position: relative; |
| | | } |
| | | } |