美文网首页
折线图方案 InteractiveDataDisplay 使用笔

折线图方案 InteractiveDataDisplay 使用笔

作者: 土DOU吹雪 | 来源:发表于2019-10-15 14:34 被阅读0次

1.InteractiveDataDisplay 元素对应

下面是 InteractiveDataDisplay 的折线图代码:

    <!--折线图-->
    <d3:Chart Name="pixel_linechart_Chart_" Margin="0,1,0,-1" KeyDown="putDirectionKey_Chart_KeyDown">
        <!--折线图中坐标-->
        <d3:Plot Name="pixel_linechart_Plot_">
            <!--折线图中曲线-->
            <d3:LineGraph Name="pixel_linechart_LineGraph_" Description="Line Pixels" Stroke="Blue"/>
        </d3:Plot>
    </d3:Chart>

在上述代码中,“d3:Chart”对应整个折线图,“d3:Plot”对应坐标轴,“d3:LineGraph”对应图中蓝线。

2.屏幕坐标

窗口和屏幕坐标系的零点在左上角,分别向右向下增加,如下图所示:


窗口中坐标和屏幕坐标会不一致,可以通过 PointToScreen 和 PointFromScreen 函数完成 窗口坐标和屏幕坐标之间的转换。

3.Chart、Plot和LineGraph 类中相关参数的转换如下图所示

4.PreviewKeyDown 和 KeyDown

With the exception of direct events, WPF defines most routed events in pairs - one tunnelling and the other bubbling. The tunnelling event name always begins with 'Preview' and is raised first. This gives parents the chance to see the event before it reaches the child. This is followed by the bubbling counterpart. In most cases, you will handle only the bubbling one. The Preview would be usually used to
1.block the event (e.Handled = true)
2.cause the parent to do something in advance to normal event handling.

某些按键,像TAB,RETRUN,ESC和方向键会被控件自动处理,也就是说这些按键的事件并不会被KeyPress事件处理方法捕获。为了使这些按键能够激发KeyDown事件,我们必须在窗体中的每个控件中重写IsInputKey方法。在IsInputKey重写的代码中需要去判定是否有特殊按键被按下,如果有则返回一个True值。

相关文章

网友评论

      本文标题:折线图方案 InteractiveDataDisplay 使用笔

      本文链接:https://www.haomeiwen.com/subject/farsmctx.html