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 ...
随机推荐
- java.lang.OutOfMemoryError:GC overhead limit exceeded解决方法
异常如下:Exception in thread "main" java.lang.OutOfMemoryError: GC overhead limit exceeded 一.解 ...
- ElasticSearch日常使用脚本
1.启动服务要切换到非root账户 (例子:su - elk --command="/usr/local/elk/kibana/bin/kibana serve &")2. ...
- phpstudy打开网页很慢如何处理
目录下,.env 配置数据库连接改为DB_HOST=127.0.0.1
- Collections与Collection
Collection是集合体系的最顶层,包含了集合体系的共性 Collections是一个工具类,方法都是用用Collection Collections方法: //static int binary ...
- 使用MagickNet编辑图片
ImageMagick是一个免费的创建.编辑.合成图片的软件.它可以读取.转换.写入多种格式的图片.图片切割.颜色替换.各种效果的应用,图片的旋转.组合,文本,直线,多边形,椭圆,曲线 ...
- 消息中间件 rabbitMQ
参考内容:https://www.cnblogs.com/dwlsxj/p/RabbitMQ.html 一.什么是RabbitMQ RabbitMQ是一个由erlang 开发的AMQP(Advance ...
- Windows下phpstudy配置tp5的nginx时遇到的奇葩问题
nginx原来的配置: hosts已经配置好127.0.0.1 到tpdev1.net这个域名 最后结果 No input file specified. 解决方法: 找到原因了,竟然是root的分隔 ...
- git命令行获取某分支代码
参考https://www.cnblogs.com/nylcy/p/6569284.html git clone -b branch1 http://xxx.xx.xxx... git clone - ...
- H5(ionic2+VScode) 环境安装
一:node.js.npm.cnpm.cordova环境安装 介绍下概念 node.js 非阻塞异步的Ajax 操作基础框架. npm 国外的node.js 包管理器 cnpm 国内淘宝的node.j ...
- git 免密码push
git版本2.14.1 windows系统 用户根目录 .gitconfig 文件添加配置 [credential] helper = store[push] default = simple 用户根 ...