DynamicDataDisplay 双击获取坐标

近日由于项目需要,学习了DynamicDataDisplay实现动态曲线图,网上的资料基本上够用了,就是双击获得数据点没能找到资料,只好下载了DynamicDataDisplay的源码来学习。总结共享如下:

1、xaml定义

<d3:ChartPlotter Name="chart0" MouseDoubleClick="chart1_MouseDoubleClick">
                <d3:ChartPlotter.HorizontalAxis>
                    <d3:HorizontalIntegerAxis></d3:HorizontalIntegerAxis>
                </d3:ChartPlotter.HorizontalAxis>
                <d3:ChartPlotter.VerticalAxis>
                    <d3:VerticalIntegerAxis></d3:VerticalIntegerAxis>
                </d3:ChartPlotter.VerticalAxis>
                <d3:HorizontalAxisTitle Content="rotate(℃)" Name="chart2Title"></d3:HorizontalAxisTitle>
            </d3:ChartPlotter>
2、变量定义

private ObservableDataSource<Point> dataSources = new ObservableDataSource<Point>();

private int t=0;

3、Window_Loaded中

chart0.AddLineGraph(dataSources, Color.Red, 3, ‘A‘);

chart0.FitToView();
4、利用timer加入数据

DispatcherTimer            timerSine = new DispatcherTimer();
                    timerSine.Tick += new EventHandler(timerSine_Tick);
                    timerSine.Interval = TimeSpan.FromMilliseconds(10);
timerSine.Start();

private void timerSine_Tick(object sender, EventArgs e)
        {
                dataSources.AppendAsync(Dispatcher, new Point(t, 2*t));

t+= timerSine.Interval.Milliseconds;

}

5、双击获得数据点Point

private void chart0_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
                ChartPlotter chart = sender as ChartPlotter;
                Point p = e.GetPosition(this).ScreenToData(chart.Transform);
        }

时间: 2024-08-08 12:18:25

DynamicDataDisplay 双击获取坐标的相关文章

在Google Map中使用地址获取坐标(适用小数据量)

近期手上有个95条数据的地址信息,想把地址转换成经纬度坐标,叠加在底图上.ESRI的online作为专业的云平台,号称提供地理编码服务,可能使用自己的数据制作Web map,于是转成CSV后试了下,结果只有4条记录转换成坐标了,并且都偏离了一个省的范围,基本上不可用.后来想在google earth上试下,使用地址搜索,也不知道是服务器慢,还是什么其他原因,earth的搜索功能简直处于瘫痪状态,打一个地址,10分钟能反应过来,结果基本上是找不到.无奈之下,又试了试google Map,Map上是

百度地图 layer弹出地图 获取坐标

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>layer弹出百度地图</title> <script src="jquery.min.js"></script> <script src="layer/layer.js"><

【HERE地图开发记录】点击地图获取坐标

最近的一个项目需要获取国外较多的POI等信息,GOOGLE在墙内开发实在麻烦,最后选用了N记的HERE地图,在这里不定期记录一些东西. 开发起来麻烦的东西是挺多的,特别是我之前也没接触过地图开发,一来就使用这个少人使用的地图来开发,很多问题基本GOOGLE stackoverflow没搜到有用的,关于API的话,例子还是足够的,不过前面说到由于个人没做过地图开发,找起来挺费劲的,官网的搜索引擎实在不敢恭维. 这篇博文主要记录下怎么样在点击地图某处后获取坐标(本文会用JS API) 1. 首先前面

for循环获取坐标

简单了解一下for循环获取坐标,for循环是js中经常用到,一般情况下,页面上有很多元素的情况下,我们不可能一一的去添加,所以就会用到for循环.今天先简单写一个获取页面元素的坐标,首先先动态给页面添加10个div,并把每个div写一个50*50的宽高给个绝对定位:然后要实现的效果是让每个div都依次的排开:代码如下: 1 <script> 2 window.onload = function (){ 3 var aDiv = document.getElementsByTagName('di

关于获取坐标的一些记录 ——分析淘宝放大镜效果的原理

这是距离相关的 el.offsetTop 表示的是元素el到body的最顶部的距离 : 就是body有多高 就是多高的距离,不会因为缩放窗口而改变. el.offsetWidth 是el元素的看起来的宽度 ,padding也会被算上 el.clientWidth 是获取元素的宽度 这里就额外提一下. 以下是鼠标坐标的: e.movementY 是鼠标点相对于上一次的坐标的移动距离 一般都不准确 e.pageY 是鼠标点相对于body的距离 随着鼠标移动一直变化 以下是网上查到的一些资料 网页可见

【API】高德地图API JS实现获取坐标和回显点标记

1.搜索+选择+获取经纬度和详细地址 2.回显数据并点标记 3.实现 第一步:引入资源文件 <!--引入高德地图JSAPI --><script src="//webapi.amap.com/maps?v=1.3&key=在官网申请一个key"></script><!--引入UI组件库(1.0版本) --><script src="//webapi.amap.com/ui/1.0/main.js">

从json获取坐标,生成地图覆盖物

package com.chencheng.meituan.view; import java.util.ArrayList; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.b

百度编辑器(ueditor)@功能之获取坐标

//获取百度编辑器的工具类 var domUtils = UE.dom.domUtils; //获取编辑器的坐标 var $ueditor_offset = $("#ueditor_0").offset(); //创建一个临时dom,用于获取当前光标的坐标 var bk_start = ue.selection.getRange().createBookmark().start; //设置临时dom不隐藏 bk_start.style.display = ''; //计算出x坐标 va

Android dp和px之间转换 及 获取坐标

dp.px.sp转换 1 public class DensityUtil { 2 /** 3 * 将px值转换为dip或dp值,保证尺寸大小不变 4 * 5 * @param pxValue 6 * @param scale 7 * (DisplayMetrics类中属性density) 8 */ 9 public static int px2dip(float pxValue, float scale) { 10 return (int) (pxValue / scale + 0.5f);