Click here to Skip to main content
15,791,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Can someone help me to make a program for this type of graph?
I have three labels:
1st label is for the Input Count
2nd label is for the Output Count
3rd label is for my Total Target

In the Graph, I want to show:
Y axis the Total Target I input in 3rd label
X axis is the time that shows the count every hour (Ex: 7:00 Am, start 0, 8:00 AM, show the current count of Input 100 then Output 98, based on the current count in Label 1 and Label 2. I want to update it in real-time (this one is no concern. I can do it in my program.) but the X axis shows every hour only like 7:00 AM, 8:00 AM, and so on.

I tried to make and search but I cannot find any help.
I already made the program but I cannot make it based on my requirements.
I hope someone can help with my problem.

I will attach my current code but this one cannot help since my request is not the same as this code.
The chart type also I want to use is spline or line type.

What I have tried:

If Integer.TryParse(lblCounter.Text, value1) AndAlso Integer.TryParse(lblSignalCount1.Text, value2) AndAlso Integer.TryParse(DiffCount.Text, value3) Then
            Dim series As New Series()
            series.ChartType = SeriesChartType.Column
            series.IsValueShownAsLabel = Enabled
            series.LabelBackColor = Color.Green
            series.LabelBorderColor = Color.Red
            series.LabelForeColor = Color.Yellow
            series.Points.AddXY("Input", value1)
            series.Points.AddXY("Output", value2)
            series.Color = Color.Green

        End If
Updated 16-Aug-23 8:38am

1 solution

Here is a library that will do what you need: NuGet Gallery | WinForms.DataVisualization 1.8.0[^]

You can download the source code and run the sample app. It has both C# and VB sample code with over 100 samples for you: GitHub - kirsan31/winforms-datavisualization: System.Windows.Forms.DataVisualization provides charting for WinForms applications.[^].
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900