none
Need help-Graphs in VB-How to create one?

    Question

  • Long story short, I have been working on a project for some time now. Now it's actually time to implement things into it. My program's aim, at the core, is to be able to calculate coordinates from an eqation-linear and quadratic-and then plot them into a graph. However so far, I have been unable to fulfil the second part. I have tried using VB Chart Controls however this is far too simple and does not work the way I need it to. For example, it will not create a empty graph with empty X and Y axis. When I do plot a graph using preset coords, it does not have negative Y and X axis. My question is, how do I do this? I have found this open source piece of software called Photon which at the core does what I aim to do however also does more. Could anyone have a look at the code and give me any pointers as to HOW he managed to create a graph like his? 

    www.youtube.com/watch?v=kHGxIvw9sBk-Link to the Open Source Software, I cant post a hyperlink since I'm not verified..

    The program has a download link in the description, however I know many of you are reluctant to have a look. I can provide parts of the code here since I downloaded it however there are pages and pages of it. Which is part of the problem-the code is far too advanced and long for me to be able to understand anything from it!

    Thanks,


    • Edited by Bailfyre Saturday, January 11, 2014 2:44 PM Inserted YT Link
    Saturday, January 11, 2014 2:39 PM

Answers

  • Here is the youtube link.

    I have looked at this and it seems legit although I did not download the code as Bailfrye emailed it to me as text. Looks like fun. I dont have much time to spend on it this weekend.

    There is also background in this forum link.

    I'm not that experienced with the vb chart control but it may be it can do a lot of what is in the video. Bailfrye wants to be able to zoom in/out and change axis etc. Not sure if the chart does that exactly but seems you can just redraw a chart control to zoom in etc?


    Saturday, January 11, 2014 3:17 PM
  • Equation Calculator with Graphing

    Graphing Calculator Demo

    "I have tried using VB Chart Controls however this is far too simple and does not work the way I need it to".


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, January 11, 2014 7:38 PM

All replies

  • Here is the youtube link.

    I have looked at this and it seems legit although I did not download the code as Bailfrye emailed it to me as text. Looks like fun. I dont have much time to spend on it this weekend.

    There is also background in this forum link.

    I'm not that experienced with the vb chart control but it may be it can do a lot of what is in the video. Bailfrye wants to be able to zoom in/out and change axis etc. Not sure if the chart does that exactly but seems you can just redraw a chart control to zoom in etc?


    Saturday, January 11, 2014 3:17 PM
  • Equation Calculator with Graphing

    Graphing Calculator Demo

    "I have tried using VB Chart Controls however this is far too simple and does not work the way I need it to".


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, January 11, 2014 7:38 PM

  • "I have tried using VB Chart Controls however this is far too simple and does not work the way I need it to".



    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    How? I figured out how to create a simple line graph with coordinates, however it doesn't draw the negative axis regardless of whether the points are negative or not. Furthermore, could a grid be implemented in these so that it's easier to read off the numbers on the axis? I'm going to have a look at those links, but forgive me if I don't understand it as I am a beginner. 

    Thanks,

    Saturday, January 11, 2014 7:47 PM
  • Graphing calculator demo (running in VS 2012 debugger).


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, January 11, 2014 7:55 PM
  • Graphing calculator demo (running in VS 2012 debugger).



    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    What is this? I have no idea what it is, and it doesn't look like the type of graph I want to draw. Mind an explanation after the SSs?
    Saturday, January 11, 2014 9:08 PM

  • Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Sunday, January 12, 2014 2:18 AM


  • Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Bravo
    Sunday, January 12, 2014 9:52 AM
  • Oooooh. Very nice Monkeyboy. I was hoping you would pop in.

    Is this running the graphing calculator demo you gave the link too?

    Sunday, January 12, 2014 3:11 PM
  • Oooooh. Very nice Monkeyboy. I was hoping you would pop in.

    Is this running the graphing calculator demo you gave the link too?

    No. That's just the Chart Control with some made up points in it.

    The graphing calc demo is shown below graphing 2D an equation. In the second and third pic I chose 2D. In the fourth pic it popped up an equation from out of nowhere and then I chose Graph It which is the fifth pic. It's all in C# though. I downloaded the executable and ran it which unzips the project. I unzipped it to a folder on my desktop rather than where the executable wanted to unzip it to.

    I would try graphing that equation in the chart control but I don't know how to get all the points for it.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Sunday, January 12, 2014 3:36 PM
  • Monkeyboy,

    I see. Well it certainly looks impressive. I am off to look at it.

    Sunday, January 12, 2014 4:08 PM
  • Monkeyboy,

    I see. Well it certainly looks impressive. I am off to look at it.

    I figured you will like it since it "demonstrates some of the advanced 2-D and 3-D Windows Presentation Foundation (WPF) drawing capabilities".

    I think I'll attempt to graph this equations points in the Chart Control. Although the amount of points is much less than what the graphing calc demo graphed for the same equation. As can be seen in the image below.

    Option Strict On
    
    Imports Microsoft.VisualBasic
    
    Public Class Form1
    
        Dim EquationInfo As New List(Of Double)
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.CenterToScreen()
            For x = -10 To 10
                EquationInfo.Add(x * Math.Sin(x ^ 2) + x)
            Next
    
            For Each Item In EquationInfo
                RichTextBox1.AppendText(Item.ToString & vbCrLf)
            Next
        End Sub
    
    End Class


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Sunday, January 12, 2014 4:20 PM
  • Well I tried it but it doesn't look the same.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Monday, January 13, 2014 5:32 AM
  • Well I tried it but it doesn't look the same.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    I am not sure what you are doing. But I did find how to change the axis range:

            With Chart1.ChartAreas(chartindex)
    
                .AxisX.Maximum = 10
                .AxisX.Minimum = -10
                .AxisY.Maximum = 100
                .AxisY.Minimum = -20
    
            End With
    
    

    Monday, January 13, 2014 5:58 AM
  • I am not sure what you are doing. But I did find how to change the axis range:

            With Chart1.ChartAreas(chartindex)
    
                .AxisX.Maximum = 10
                .AxisX.Minimum = -10
                .AxisY.Maximum = 100
                .AxisY.Minimum = -20
    
            End With

    PS Just for anyone still playing along with the chart control at home its the The Axis class.

    Edit: guess it may help to show the code which is just for samples, not my final grade:

        Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            'use chart control
            Dim x, y, interval As Double
            Dim i, totalpoints as integer
            Dim chartindex As Integer
    
            Chart1.Series.Clear()
            Chart1.Series.Add("(2 * x ^ 2) - 15")
    
            chartindex = 0  ' Chart1.Series.Count - 1
    
            With Chart1.ChartAreas(chartindex)
                .AxisX.Maximum = 10
                .AxisX.Minimum = -10
                .AxisY.Maximum = 100
                .AxisY.Minimum = -20
    
            End With
    
            Chart1.Series(chartindex).ChartType = DataVisualization.Charting.SeriesChartType.Line
    
             interval = 0.1
            x = -10
            totalpoints = 200
    
            For i = 0 To totalpoints
                x = x + interval
                y = (2 * x ^ 2) - 15
                Chart1.Series(chartindex).Points.AddXY(x, y)
            Next
    
            Chart1.Series.Add("(4 * x ^ 2) - 15")
            chartindex = 1
    
            Chart1.Series(chartindex).ChartType = DataVisualization.Charting.SeriesChartType.Line
    
            interval = 0.1
            x = -10
            totalpoints = 200
    
            For i = 0 To totalpoints
                x = x + interval
                y = (4 * x ^ 2) - 15
                Chart1.Series(chartindex).Points.AddXY(x, y)
            Next
    
        End Sub
    
    End Class


    • Edited by tommytwotrain Monday, January 13, 2014 6:26 AM added code
    Monday, January 13, 2014 6:09 AM