Giter VIP home page Giter VIP logo

graphing's Introduction

Graphing

This is a graphing calculator I made initially for a Calculus project in a day or so. I've written a basic rendering system in Windows Forms that runs on .NET 8.0.

Currently, it doesn't have a whole lot of features, but I'll be adding more in the future. Here's currently what it can do:

  • Graph standard equations (duh).
    • There are currently some rendering issues with asymptotes which will be focused on at some point.
  • Graph parametric equations.
  • Integrate and derive equations.
  • Graph a slope field of a dy/dx = style equation.
  • View a tangent line of an equation.
  • Display a vertical bar graph.

However, you can develop your own features as well.

The system does not and likely will not (at least for a while) support text-to-equation parsing. You must import this project as a library and add graphs that way.

There are some tools in the menu bar that can assist but those are fairly limited and will be added on to in the future. For now, you can drag to move the graph and use the mouse wheel to zoom. Fairly self-explanatory, I think.

How to Install

This project is a NuGet package, so if you want to install it that way, you can do so.

  • In the terminal for your project, run dotnet add package ThatOneNerd.Graphing
  • Alternatively, you can search for the package called "ThatOneNerd.Graphing" in the Visual Studio NuGet Package Manager.
  • If you have an alternative package manager and know how to use it, then do that instead obviously.

You can also directly import the DLL file. Go to the latest release and download the ZIP folder called "ThatOneNerd.Graphing.zip". Extract the contents somewhere you can access.

  • In Visual Studio, you can then right click your project in the solution explorer, go to Add > Project Reference, and browse for the DLL called "ThatOneNerd.Graphing.dll"
  • If you want to edit the project file itself, you can. Open the .csproj file and add the following lines to the XML:
<ItemGroup>
  <Reference Include="Graphing">
    <HintPath>FILE PATH GOES HERE (can be relative)</HintPath>
  </Reference>
</ItemGroup>
  • If you have a different IDE, I don't know how to help you with that.

How to Use

Once you've installed the package, you just need to use standard Windows Forms startup code.

using Graphing.Forms;
using Graphing.Graphables;

internal static class Program
{
    [STAThread]
    public static void Main()
    {
        // Optional configuration.
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);

        // Create the graph form and give it a name.
        GraphForm graph = new("Form Name");

        // Graph the equation x^2.
        graph.Graph(new Equation(x => x * x));

        // Display the graph.
        Application.Run(graph);
    }
}

That's it. Not bad, eh?

An equation requires a delegate such as the one you see. Alternatively, you can change the name and color of the equation.

graph.Graph(new Equation(x => Math.Pow(2, x))
{
    Color = Color.Green,
    Name = "Exponential Base 2"
});

Default colors and names are assigned if none are provided.

Slope fields work quite the same way, but with a delegate taking in both an x and a y.

graph.Graph(new SlopeField((x, y) => -y / x)
{
    Color = Color.DarkRed,
    Name = "Slope Field Example"
});

You've got the hang of this. I'll be adding more features for a while.

graphing's People

Contributors

that-one-nerd avatar

Stargazers

Bogdan Antonenko avatar Jacob Maurer avatar  avatar

Watchers

 avatar

graphing's Issues

Replace the standard dragging system with a callback to the specific graphable.

I want to rework what I've kind of just made. It's good for now but I think in the future it should fall on the graphable's shoulders to do dragging behavior. Take slope fields, for example. I think rather than just showing the point on the line where your cursor is, I think it should display the slope at that point.

I think I'll do this for 1.5

Add inequalities

This was Sophie's idea.
Both the left and right hand sides will be equations.

Add callbacks to all graphable types for various events.

This is going to be a big change which is why it's on the backlog for now.
I want to add events for things like mouse dragging. Now, instead of selecting specific points automatically, that will fall onto the graphable to make that rendering.

Add a "fill integral"

Not really sure what to call this. It'll be like the integral graphable but actually show the shaded area.

Add the ability to create taylor series for equations.

Make it a menu item. Not sure whether to put it in the "operations" category or the "convert" category yet.
Could either be "Operations > Create Taylor Series" or "Convert > Polynomial (Taylor Series)."

Personally leaning towards the former but I'm not sure yet.

Make line thickness dependent on DPI.

The device I mostly program with has a 1800p screen with a high DPI mode on, so this graphing calculator has thin and I think pretty lines. However, on a standard 1080p screen without high DPI, the lines look way too fat. I'll fix this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.