vue中使用TradingView --7 自定义初始化指标线,设置颜色,自定义是否显示


添加折线

_this. MALine5 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 5], null, { 'Plot.color' : '#642d92'});
_this. MALine10 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 10], null, { 'Plot.color' : '#5278a3'});
_this. MALine30 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 30], null, { 'Plot.color' : '#238031'});
_this. MALine60 = _this. chart. chart(). createStudy( 'Moving Average', false, false, [ 60], null, { 'Plot.color' : '#850058'});

隐藏折线

_this. chart. chart(). getStudyById( _this. MALine5). setVisible( false);
_this. chart. chart(). getStudyById( _this. MALine10). setVisible( false);
_this. chart. chart(). getStudyById( _this. MALine30). setVisible( false);
_this. chart. chart(). getStudyById( _this. MALine60). setVisible( false);

需要注意的是以上方法均在 onchartready里面执行

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 13
    评论
Vue3组合式API使用vue-baidu-map-3x自定义地图心点,可以按照以下步骤: 1. 安装vue-baidu-map-3x 你可以通过以下命令使用npm安装vue-baidu-map-3x: ``` npm install vue-baidu-map-3x --save ``` 2. 在组合式API引入vue-baidu-map-3x 在需要使用百度地图的组件,你需要先引入vue-baidu-map-3x。例如,在一个名为Map.vue的组件,你可以这样引入: ``` <script> import { defineComponent } from 'vue' import BaiduMap from 'vue-baidu-map-3x' export default defineComponent({ components: { BaiduMap }, setup() { // 组合式API的代码 } }) </script> ``` 3. 在setup函数定义地图心点 在setup函数,你可以定义地图的心点和缩放级别。例如: ``` <script> import { defineComponent } from 'vue' import BaiduMap from 'vue-baidu-map-3x' export default defineComponent({ components: { BaiduMap }, setup() { const center = { lng: 116.404, lat: 39.915 } const zoom = 12 return { center, zoom } } }) </script> ``` 在这个例子,我们定义了地图的心点为北京市心,缩放级别为12。 4. 在模板使用地图 最后,在模板使用vue-baidu-map-3x组件,并且传入定义的心点和缩放级别。例如: ``` <template> <div class="map-container"> <baidu-map :center="center" :zoom="zoom"></baidu-map> </div> </template> ``` 现在,你已经在Vue3组合式API使用vue-baidu-map-3x自定义了地图的心点。你可以通过修改center的值来改变地图的心点。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值