Click here to Skip to main content
15,922,007 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I need to draw a line graph (online) where the x-axis is the time and the y-axis is a string value (in Visual Studio 2012 Windows Form). All these values ​​are stored in a text file. Can anyone help me?
thank you very much.
my file.txt same as:
2024-01-10,22,17:15:42,0,0,0,0,0,0,0,0
2024-01-10,17:15:42,15,15,203,203,177,177,178,173
2024-01-10,17:16:16,15,15,202,203,175,176,176,171
2024-01-10,17:16:17,15,15,202,203,176,176,177,171
2024-01-10,17:16:18,15,15,202,203,176,176,177,172


What I have tried:

C#

Posted
Comments
Richard Deeming 12-Jan-24 10:02am    
So you've tried nothing, and want someone to do all the work for you?

How about you start by trying something, and ask for help if you get stuck? Eg:
Progressive Line | Chart.js[^]

But having "a string value" for the y-axis doesn't make any sense. A line chart requires a numeric value to determine where the line is drawn.
Member 15078969 12-Jan-24 13:58pm    
Dear Sir, Thank you for your attention. 1- Now I can't set the value of date and time (the first column of the file) in the X-axis online. Also, in the searches, all the examples are random based on the X-axis and Y-axis. 2- The second and third column and... the text file is the values ​​received through the network card (communication with the PLC), and one line is saved in the file every second.
[no name] 13-Jan-24 15:25pm    
Y isn't a "string"; it's a bunch of integers; 8 for each datetime; implying eight (8) time series; or 8 chart lines. You have 8 "data series".

1 solution

This library will do what you want: LiveCharts - LiveCharts2[^] and a sample of what you are trying to achieve: samples.lines.autoupdate - LiveCharts2[^]
 
Share this answer
 
v2

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