本文介绍了在套接字编程中读取数据的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#windows应用程序上有一个图表。当鼠标放在它们上面时,我想缩放图表的每个点。喜欢谷歌地图



我的意思是我不想缩放图表的所有部分我想要缩放只是像谷歌地图一样的特殊点



代码:

I have a chart on my c# windows application. I want to zoom every point of chart when mouse on them. like google map

I mean I don't want zoom all part of chart I want zoom just specefic point like google map

code:

void CreateNewGraph()
            {
                // Create new Graph
                chart = new Graph.Chart();
    
               
                chart.Location = new System.Drawing.Point(13, 185);
    
               
                chart.Size = new System.Drawing.Size(900, 500);
    
               
                chart.ChartAreas.Add("draw");
    
                
    
                
                chart.ChartAreas["draw"].AxisX.Minimum = 0;
                chart.ChartAreas["draw"].AxisX.Maximum = 20;
    
                
                chart.ChartAreas["draw"].AxisX.Interval = 1;
    
               
                chart.ChartAreas["draw"].AxisX.MajorGrid.LineColor = Color.White;
    
                
                chart.ChartAreas["draw"].AxisX.MajorGrid.LineDashStyle = Graph.ChartDashStyle.Dash;
    
                
                chart.ChartAreas["draw"].AxisY.Minimum = -0.4;
                chart.ChartAreas["draw"].AxisY.Maximum = 1;
    
                
                chart.ChartAreas["draw"].AxisY.Interval = 0.2;
    
                
                chart.ChartAreas["draw"].AxisY.MajorGrid.LineColor = Color.White;
    
                
                chart.ChartAreas["draw"].AxisY.MajorGrid.LineDashStyle = Graph.ChartDashStyle.Dash;
    
                
                chart.ChartAreas["draw"].BackColor = Color.Black;
    
    
                
                var series = chart.Series.Add("Test");
    
                   
                chart.Series["Test"].ChartType = Graph.SeriesChartType.Line;
    
                
                chart.Series["Test"].Color = Color.Yellow;
    
               
                chart.Series["Test"].BorderWidth = 3;
    
    
                chart.Legends.Add("MyLegend");
                chart.Legends["MyLegend"].BorderColor = Color.YellowGreen;
    
                // Set automatic zooming
                chart.ChartAreas["draw"].AxisX.ScaleView.Zoomable = true;
                chart.ChartAreas["draw"].AxisY.ScaleView.Zoomable = true;
    
                // Set automatic scrolling 
                chart.ChartAreas["draw"].CursorX.AutoScroll = true;
                chart.ChartAreas["draw"].CursorY.AutoScroll = true;
    
                // Allow user selection for Zoom
                chart.ChartAreas["draw"].CursorX.IsUserSelectionEnabled = true;
                chart.ChartAreas["draw"].CursorY.IsUserSelectionEnabled = true;
    
                chart.ChartAreas["draw"].AxisX.ScaleView.Zoomable = true;
                chart.ChartAreas["draw"].AxisY.ScaleView.Zoomable = true;
    
                //chart.MouseWheel += new MouseEventHandler(chart_MouseWheel);
            }

推荐答案


这篇关于在套接字编程中读取数据的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 13:18