Tag Archives: Polyline

Zoom on a graph with XAML code in C#

This example shows how you can zoom on a graph with XAML code only, without using C# code. (The program does use C# code to build the graph. It just doesn’t use any to zoom.) The example Zoom in on … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Zoom on a graph in WPF and C#

It’s remarkably easy to zoom on a graph in WPF. This example extends the example Let the user click on graph points in WPF and C#. To modify the previous version, you first need to rebuild the user interface a … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Let the user click on graph points in WPF and C#

This example shows how you can let a user click on graph points to display information about the data. (It extends the example Draw a graph with rotated text in WPF and C#.) When the user moves the mouse over … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Draw a graph with rotated text in WPF and C#

This example shows how you can draw a graph with rotated text. The example Draw a graph with labels in WPF and C# has a DrawText method that makes adding text to a graph relatively easy. This example uses the … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | 2 Comments

Draw a graph with labels in WPF and C#

This example shows how you can draw a graph with labels. The previous example Draw a graph with even tic marks in WPF and C# draws a simple graph. This example adds a title and labels to the X and … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Draw a graph with even tic marks in WPF and C#

This example shows how you can draw a graph with even tic marks in WPF and C#. It’s easy but confusing so I’m going to over-explain it. Once you get the idea, just skip down to the code. If you … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , , | 1 Comment

Use transformations to draw a graph in WPF and C#

Background This example shows how you can use transformations to draw a graph in WPF. In two-dimensional graphics, transformations let you translate, scale, rotate, and skew the objects you draw. My previous post, Draw a graph in WPF and C#, … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , | 11 Comments

Draw a graph in WPF and C#

Graphing Difficulties This example shows how to draw a graph in WPF and C#. Drawing graphics is always tricky because you typically need to work in at least two different coordinate systems. First, there’s the world coordinates that you want … Continue reading

Posted in algorithms, drawing, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , | 17 Comments

Use DrawPolygon and DrawLines to draw shapes (and understand the different results) in C#

The Graphics object’s DrawPolygon method connects the points in an array of Point or PointF to draw a polygon. It automatically draws a line between the first and last points to close the polygon. The DrawLines method connects the points … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , | 2 Comments

Draw striped lines in C#

You can use the Pen class to draw striped lines. That class’s CompoundArray property stores an array of floats that gives the fraction of the line’s width that is drawn and skipped. For example, the array 0.0, 0.25, 0.75, 1.0 … Continue reading

Posted in drawing, graphics | Tagged , , , , , , , , , , , , | Leave a comment