图表压缩 [英] Chart Compression

查看:208
本文介绍了图表压缩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个需要一些值(Y值,X - (in)时间)的图形表示(XoY)的C#桌面应用程序。

  chart1.Series [0] .Points.AddXY(time,new Random()。Next(-325,531)); //此操作以设置的间隔发生

操作完成其作业,



/i.stack.imgur.com/fG4ww.pngalt =phase0>



我想



    >
  1. 我认为一个很好的图形表示示例是由示波器生成的示例

  2. 图表是样条

  3. 根据您的需要,有多种选择。 我的猜测是,你想保留所有的数据点,只是想添加一个滚动条。你可以这样写:

      ChartArea A1 = chart1.ChartAreas [yourChartAreaByNameOrNumber]; 
    A1.AxisX.ScrollBar.Size = 12;
    //只显示中心滚动按钮..
    A2.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
    // ..或包括左和右按钮:
    A1.AxisX.ScrollBar.ButtonStyle =
    ScrollBarButtonStyles.All ^ ScrollBarButtonStyles.ResetZoom;
    //看起来更好,但是ymmv
    A1.AxisX.ScrollBar.IsPositionedInside = true;
    A1.AxisX.ScrollBar.Enabled = true;
    A1.AxisX.ScaleView.Size = 100; // number(!)of data points visible

    您可能想要使用大小和位置。请选择您希望随时可见的数据点数。



    如果您希望可见区域跟踪示波器中的新数据,您可以设置滚动位置:

     系列S1 = chart1.Series [yourSeriesByNameOrNumber]; 
    A1.AxisX.ScaleView.Position = S1.Points.Count - A1.AxisX.ScaleView.Size;

    请注意,您需要在添加任何数据后再次设置!


    I am writing a C# desktop application that requires a graphical representation (XoY) of some values (Y - value, X - (in) time).

    chart1.Series[0].Points.AddXY(time, new Random().Next(-325, 531)); //this operation occurs at a set interval
    

    The operation does its job, adding up values; however, in time the chart has the tendency to "squeeze" itself which makes interpreting it a much harder task.

    I want to make the graphic generate a better output, despite the number of points.

    Notes

    1. I consider that a good example of graphical representation would be one generated by an oscilloscope.
    2. The chart is an spline.
    3. The point addition is triggered upon a tick of a timer.

    解决方案

    Depending on what you want there are several choices. My guess is that you want to keep all data points and simply want to add a scrollbar. To do you can write:

    ChartArea A1 = chart1.ChartAreas["yourChartAreaByNameOrNumber"];
    A1.AxisX.ScrollBar.Size = 12;
    // show either just the center scroll button..
    A2.AxisX.ScrollBar.ButtonStyle = ScrollBarButtonStyles.SmallScroll;
    // .. or include the left and right buttons:
    A1.AxisX.ScrollBar.ButtonStyle = 
        ScrollBarButtonStyles.All ^ ScrollBarButtonStyles.ResetZoom;
    // looks better inside, but ymmv
    A1.AxisX.ScrollBar.IsPositionedInside = true;
    A1.AxisX.ScrollBar.Enabled = true;
    A1.AxisX.ScaleView.Size = 100;  // number (!) of data points visible
    

    You may want to play with the size and placement. Please pick the number of data points you want to have visible at any time..

    If you want the visible area to follow the new data like in an oscilloscope, you can set the scroll position :

    Series S1 = chart1.Series["yourSeriesByNameOrNumber"];
    A1.AxisX.ScaleView.Position = S1.Points.Count - A1.AxisX.ScaleView.Size;
    

    Note that you need to set it again after adding any data!

    这篇关于图表压缩的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆