angular 实现 echarts 拖动区域进行放大 方法
- 实现逻辑:
1.通过鼠标摁下事件 和弹出事件 获取x轴的index 之后去x轴的list中去获取两个坐标点
2.之后将这两个数据作为参数 传到后台更新数据
3.记录下来这两个坐标点 放到list中 在前台提供向前一步和向后一步的按钮 实现回退功能
4.需要注意的是:需要在myChart初始话之后再添加事件还有就是避免重复添加事件 只在mychart第一次初始化的时候才给他添加鼠标点击事件 否则会导致加载很多个事件
- angular代码:
myChart.setOption(option,true);
if(flag==){
flag++;
console.log("点击事件加载") var x_start;
myChart.getZr().on('mousedown',function(params){
const pointInPixel= [params.offsetX, params.offsetY];
if (myChart.containPixel('grid',pointInPixel)) {
var pointInGrid=myChart.convertFromPixel({seriesIndex:},pointInPixel);
var xIndex=pointInGrid[];
x_start= Math.round(option.series[].data[xIndex*][]);
console.log("进入鼠标点击",xIndex);
console.log("进入鼠标点击",option.series[].data[xIndex*][]); }
});
myChart.getZr().on('mouseup',function(params){
const pointInPixel= [params.offsetX, params.offsetY];
if (myChart.containPixel('grid',pointInPixel)) {
var pointInGrid=myChart.convertFromPixel({seriesIndex:},pointInPixel);
var xIndex=pointInGrid[];
if(parseInt(x_start)<parseInt( Math.round(option.series[].data[xIndex*][]))){
$scope.depth_start = x_start;
$scope.depth_end = Math.round(option.series[].data[xIndex*][]);
}else{
$scope.depth_end= x_start;
$scope.depth_start = Math.round(option.series[].data[xIndex*][]);
}
var a={
'depth_start': $scope.depth_start,
'depth_end':$scope.depth_end
};
$scope.depth_data.push(a)
$scope.index+=;
if($scope.depth_data.length==){
$scope.depth_data_Judge=;
}else{
$scope.depth_data_Judge=;
}
$scope.createChart(); }
});
}
});
angular 实现 echarts 拖动区域进行放大 方法的更多相关文章
- js实现移动端图片预览:手势缩放, 手势拖动,双击放大...
.katex { display: block; text-align: center; white-space: nowrap; } .katex-display > .katex > ...
- 图片放大方法、、菜单栏的位置随滚轮移动固定方法、、<a></a>去外层虚线方法:a:focus { outline:none; -moz-outline:none;};
图片放大方法一: <style type="text/css">.xt{ width:230px; height:230px;}.tp{ width:230px; he ...
- Angular.js中处理页面闪烁的方法详解
Angular.js中处理页面闪烁的方法详解 前言 大家在使用{{}}绑定数据的时候,页面加载会出现满屏尽是{{xxx}}的情况.数据还没响应,但页面已经渲染了.这是因为浏览器和angularjs渲染 ...
- echarts数据区域缩放(鼠标滚轮、滚动条、拉选框)
当一个echarts图表上的数据很多时,想要查看部分区域的数据状态,可以通过数据区域缩放来实现,现总结三个方法: 鼠标滚轮缩放: var arr = []; for(var i = 0;i<15 ...
- angular引用echarts插件
方法一 1. 命令行下载 npm install echarts --savenpm install ngx-echarts --save 2. angular.json 配置echarts路径. 2 ...
- Echarts 多曲线“断点”问题解决方法
Echarts 用来做可视化曲线是非常优秀的一个库.建议使用 Echarts 作为项目的可视化图标库时,仔细研究 官方实例,根据需求来选择类似的示例,下载实例模板来开发,节省时间,减少出错,提高效率. ...
- angular结合echarts创建图表
原理: 利用angularjs中的指令(directive)将echarts封装. 步骤: 1.封装函数: app.directive('line', function() { return { re ...
- Angular页面传参的四种方法
1. 基于ui-router的页面跳转传参 (1)在Angular的app.js中用ui-route定义路由,比如有两个页面, 一个页面(producers.html)放置了多个producers,点 ...
- 【转】C# 控件的自定义拖动、改变大小方法
在用VS的窗体设计器时,我们可以发现控件都是可以拖动的,并且还可以调整大小.怎么在自己的程序中可以使用上述功能呢? 下面的方法值得借鉴! using System; using System.Wind ...
随机推荐
- React-Native: bios打开VT-x选项
问题: 我在Android Studio新建一个虚拟机的时候出现如图错误: 解决方案:重启电脑,开机的时候不停的按f12(不同的主机不一样),进入bios,然后打开Virtualization Tec ...
- [原创] debian 9.3 搭建Jira+Confluence+Bitbucket+crowd+seafile (零) 修改端口的问题
[原创] debian 9.3 搭建Jira+Confluence+Bitbucket+seafile (零) 修改端口的问题 来来来,今天说个没有人说过的事, 搭建好Jira+Confluenc ...
- django项目部署
1.布署前需要关闭调试.允许任何机器访问,在setting文件中设置 DEBUG = False ALLOW_HOSTS=['*',] 2.安装uWSGI pip install uwsgi 3.配置 ...
- 宝塔面板安装在根目录www下
不能重装,重装防火墙要重新关闭. 安装时要主要更改文件权限.
- LVS(一):基本概念和三种模式
网站架构中,负载均衡技术是实现网站架构伸缩性的主要手段之一.所谓"伸缩性",是指可以不断向集群中添加新的服务器来提升性能.缓解不断增加的并发用户访问压力. 负载均衡有好几种方式:h ...
- 数据结构python编程总结
大数据.空间限制 布隆过滤器 使用很少的空间就可以将准确率做到很高的程度(网页黑名单系统.垃圾邮件过滤系统.爬虫的网址判重系统等) 有一定的失误率 单个样本的大小不影响布隆过滤器的大小 n个输入.k个 ...
- python_1_基础知识
数据类型: 整数 浮点数 字符串 布尔值:True/False 空值:None 变量 常量 int(整型):在Python3里不再有long类型了,全都是int -2**63-2**63-1即-922 ...
- pom.xml文件释义
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- 【转载】python中not,and,or的优先级问题及用法
作业: >>> print(5<4 or 3)3>>> print(2>1 or 6)True>>> print(5>1 and ...
- odoo TransientModels must have log_access turned on