DynamicDataDisplay缩放和工具提示在具有同步X轴的实时图表上 [英] DynamicDataDisplay zoom and tooltips on realtime charts with syncronous X axis
问题描述
前一段时间,我发布了问题。我找到了解决方案,但我仍然有一些问题。
- 我需要放大和缩小在Y轴上的StrokeChart,日期。我不知道为什么,但范围不会改变下一个添加点。实际上Y轴上的范围是0-1。很奇怪,但我可以用
- 生活。第二个问题是:如何在图表区域上配置缩放?
- 最后,但不是最不重要的:如何使用ObservableCollection构建图表上的实时工具提示?它可以为EnumerableDataSource做容易。您可以检查此和 this 。我试着做用户Thecentury描述的事情,但它不工作。我甚至添加方法
AddMapping
到ObservableCollection并重建库,但它仍然不工作。所以我不知道下一步该做什么。
我非常感谢您的帮助和建议。
谢谢
关于缩放我认为我设法解决了这个问题。 / p>
在 MouseNavigation.cs 中添加新属性
// 2014-02-22 - MPEKALSKI - 添加的属性,使可能
限制只放大一个轴
私人bool? _zoomX;
///< summary>
///允许/禁止沿X轴进行缩放的属性。默认允许(true)。
///< / summary>
public bool zoomX
{
get {return _zoomX ??真正; }
set {_zoomX = value; }
}
private bool? _zoomY;
///< summary>
///允许/禁止沿Y轴进行缩放的属性。默认允许(true)。
///< / summary>
public bool zoomY
{
get {return _zoomY ??真正; }
set {_zoomY = value; }
}
在同一个类中修改方法
private void MouseWheelZoom(Point mousePos,int wheelRotationDelta)
取代
Viewport.Visible = Viewport.Visible.Zoom(zoomTo,zoomSpeed);
// 2014-02-23 - MPEKALSKI - 如果我们不允许改变Y
//然后保持旧的值,通过类推X
Rect zoomedRect = Viewport.Visible。缩放(zoomTo,zoomSpeed);
if(zoomY == false){zoomedRect.Y = Viewport.Visible.Y;
zoomedRect.Height = Viewport.Visible.Height; }
if(zoomX == false){zoomedRect.X = Viewport.Visible.X;
zoomedRect.Width = Viewport.Visible.Width; }
Viewport.Visible = zoomedRect;
现在的使用是非常简单的给定chartPlotter对象只是设置属性zoomY或zoomX为false以防止缩放此轴。
chartPlotter2.MouseNavigation.zoomY = false;
我不知道这是最好的解决方案,但它适用于我。
Some time ago I posted the question about synchronous charts. I found the solution here, but I still have some problems.
- I need to zoom in and out on Y axis on StrokeChart to see my date. I don't know why, but the range doesn't change on next added point. Actually range is 0-1 on Y axis. It's strange, but I can live with that
- The second question is: how to configure zoom on chart area? I want it to zoom only Y axis when I scroll up/down.
- And last, but not least: How to make realtime tooltips on chart which is build using ObservableCollection? It can be done for EnumerableDataSource easy. you can check this and this. I tried to do thing described by user "Thecentury", but it doesn't work. I even added method
AddMapping
to ObservableCollection and rebuilt the library, but it still doesn't work. So I don't know what to do next.
I appreciate for any help and advice. Thank you
Regarding zooming I think I managed to solve the problem.
In MouseNavigation.cs add new properties
// 2014-02-22 - MPEKALSKI - added property to make possible
limiting on zoom on only one axis
private bool? _zoomX;
/// <summary>
/// Property for allowing/disallowing for zoom along X axis. By default allowed (true).
/// </summary>
public bool zoomX
{
get { return _zoomX ?? true; }
set { _zoomX = value; }
}
private bool? _zoomY;
/// <summary>
/// Property for allowing/disallowing for zoom along Y axis. By default allowed (true).
/// </summary>
public bool zoomY
{
get { return _zoomY ?? true; }
set { _zoomY = value; }
}
In the same class modify the method
private void MouseWheelZoom(Point mousePos, int wheelRotationDelta)
by substituting
Viewport.Visible = Viewport.Visible.Zoom(zoomTo, zoomSpeed);
with
// 2014-02-23 - MPEKALSKI - if we do not allow for change in Y
// then keep the old value, by analogy for X
Rect zoomedRect = Viewport.Visible.Zoom(zoomTo, zoomSpeed);
if (zoomY == false) { zoomedRect.Y = Viewport.Visible.Y;
zoomedRect.Height = Viewport.Visible.Height; }
if (zoomX == false) { zoomedRect.X = Viewport.Visible.X;
zoomedRect.Width = Viewport.Visible.Width; }
Viewport.Visible = zoomedRect;
The use now is pretty straightforward given chartPlotter object just set properties zoomY or zoomX to false to prevent zooming along this axis.
chartPlotter2.MouseNavigation.zoomY = false;
I do not know is it the most optimal solution, but it works for me.
这篇关于DynamicDataDisplay缩放和工具提示在具有同步X轴的实时图表上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!