Tag Archives: graph

Graph the sine, cosine, and tangent functions in C#

This example is mostly an exercise in drawing but it does demonstrate a few useful graphics techniques. When you enter minimum and maximum X and Y values and click the Graph button, the following code graphs the sine, cosine, and … Continue reading

Posted in algorithms, graphics, mathematics | Tagged , , , , , , , , , , , , , , , , , | 3 Comments

Draw a labeled line graph that displays value tooltips in C#

This (fairly complicated) example maps between several different coordinate systems: The main graph is mapped from a coordinate space where 1900 ≤ x ≤ 2010 and 0 ≤ y ≤ 8000 to an area on the screen. Each data point … Continue reading

Posted in drawing, graphics, mathematics, transformations | Tagged , , , , , , , , , , , , , | 1 Comment

Use multiple threads to draw a graph in C#

This example shows how you can use multiple threads to let a program draw a graph and perform other tasks at the same time. A thread is a path of execution through a single process. Multi-threading allows an application to … Continue reading

Posted in graphics, programs, threading | Tagged , , , , , , , , , , , | 2 Comments

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