Home > Net >  How to take a long curve, c #.
How to take a long curve, c #.

Time:10-08

How many data, in the winfrom words long graph, the need to have a scroll bar, can drag back and forth, for advice,

CodePudding user response:

To find a third party controls

CodePudding user response:

Can you give a specific direction, thank you.

CodePudding user response:

You use the panel first stratification, do a canvas

CodePudding user response:

refer to the original poster azhou88 response:
a lot of data, how words in winfrom long graph, the following needs to have a scroll bar, you can drag back and forth, consult,

Mschart have drag, also have a scroll bar

CodePudding user response:

According to the position of the scroll bar to determine shows that a data,
Changes such as the following example code (micro), illustrates the 300 million data graphical,

Code references since l: [quote]
https://bbs.csdn.net/topics/390614100
13 floor
C # the big data processing [question points: 100 minutes, "post man porenasckx


 
Using System. IO;
Using System. IO. MemoryMappedFiles;

Public partial class Form1: Form
{
Public _click ()
{
//InitializeComponent ();
The string filename="example. Dat";
if (! File. The Exists (filename))
{
MessageBox. Show (" run for the first time... Create a 300 MB data file: "+ filename);
GenerateData (filename);
}
This. We=we. CreateFromFile (filename);
Enclosing scrollbar=new HScrollBar ()
{
Height=32,
The Dock=DockStyle. Bottom,
Maximum=(int) (new to the FileInfo (filename). Length/4),
};
This. The scrollbar. ValueChanged +=(sender, e)=& gt; This Invalidate (invalidateChildren: false);
This. Controls. The Add (scrollbar);
Enclosing DoubleBuffered=true;
This. Size=new Size (800, 600);
}
ScrollBar ScrollBar.
We we;

Protected override void OnPaint (PaintEventArgs e)
{
Base. The OnPaint (e);
Int from=100;
Int start=Math. Min (this) scrollbar) Value, enclosing scrollbar. Maximum - from);
Um participant raphics. DrawCurve (Pens. Black, GetPoints (start from));
Um participant raphics. DrawString (start. ToString (n0), enclosing the Font, Brushes, DarkBlue, new Point (200, 15));
}

Private PointF [] GetPoints (int start, int count)
{
List Points=new List (count);
Using (var viewStream=we CreateViewStream (start * sizeof (float), the count * sizeof (float)))
Using (var reader=new BinaryReader (viewStream))
{
for (int i=0; I & lt; The count. I++)
{
Float x=I * this. ClientRectangle. Width/100;
Float y=reader. ReadSingle (). * this ClientRectangle. Height;
Points. The Add (new PointF (x, y));
}
}
Return points. ToArray ();
}

Private void GenerateData (string outputFile, int count=75 * 1024 * 1024)
{
The Random Random=new Random (123);
Using (BinaryWriter writer=new BinaryWriter (new FileStream (outputFile, FileMode. Create)))
{
Float last=0.5 f;
for (int i=0; I & lt; The count. I++)
{
Last=last + (float) (random NextDouble () 0.5)/20;
Last=Math. Max (0, Math. Min (last, 1));
Writer. Write (last);
}
}
}
}


CodePudding user response:

Thank you, you said I'll be careful, look at the method to use, thank you, turn head junction points, points, knot predestination,

CodePudding user response:

CSDN good master much more,
  •  Tags:  
  • C#