- 0
vb.net Create a GraphicsPath to hold the line info
Asked by
sanjay kothari,
-
Recently Browsing 0 members
- No registered users viewing this page.
-
Posts
-
By MulletMan69 · Posted
Basically, they can hire someone with less skill for a lower wage, for example from India, and use AI to bring that employees output up to the level of someone more experienced and expensive. It’s a broad cost-cutting strategy, and plenty of companies are already doing it. With AI involved, the employee just needs to check that the AI's results aren’t complete junk. They don’t actually have to know how to produce the work themselves. You just get one high level employee to triple check who does. The workflow looks like this: AI generates the content, a low-skilled worker filters out anything clearly broken or wrong, and a high-skilled worker gives it a final pass. Instead of hiring a full team of experts, companies can rely on a few at the top while AI and cheaper labour handle the bulk of the process. -
By Mike Steel · Posted
Aah, always the evil terrorist group. Why not just the Russians, they're worse than any terrorist organisation. -
By zikalify · Posted
LG Electronics sees profit dip but boosts shareholder returns by Paul Hill LG Electronics (LGE) has reported consolidated sales of 20.74 trillion Korean Won (approximately $15.14 billion USD) and an operating profit of 639.4 billion Korean Won (approximately $466.75 million USD) for the second quarter of 2025. The firm saw both its revenue and operating profits decline year-over-year due to external factors such as US tariff policies, ongoing geopolitical issues in the Middle East, and a slowdown in consumer spending. While the company has faced challenges, the company is aiming for what it called qualitative growth by strengthening its subscription services, direct online sales, and business-to-business (B2B) segments. Key areas of growth for LGE include automotive electronics, heating, ventilation, and air conditioning (HVAC) systems, and the webOS platform. The US tariffs are a major headache for companies around the world, given the size of the market there and President Trump's demands for bringing manufacturing to the States. To combat the rising US tariffs, LGE is trying to optimize global production and refine its market-specific approaches for premium and mass-market products. While the company’s profits dipped, it announced an interim dividend of 500 Korean Won (approximately $0.37 USD) per share for both common and preferred, with another payout later in the year that should take the total for 2025 to at least 1,000 Korean Won (approximately $0.73 USD). You must be holding the stock on August 8, 2025, to get the payout on August 22, 2025. The firm also said it will cancel 761,427 common treasury shares on July 31, 2025, making shares more scarce which could increase the value of remaining shares for investors. In terms of LGE’s various business divisions, things were mixed. Its Home Appliance Solution (HS) business achieved year-over-year sales growth, maintaining profitability, thanks to a dual strategy for premium and volume segments and growth in online sales and subscriptions. Its Media Entertainment Solution (MS) business experienced declines in sales and operating profits with the latter turning negative due to market uncertainties and stiff competition. Its Vehicle Solution (VS) business showed growth in sales and operating profit thanks to increased orders from European automotive makers. Finally, its Eco Solution (ES) business saw domestic sales increase, but overseas sales growth was limited due to US tariffs. This led to a slight year-over-year drop in operating profit due to higher costs. Image via Depositphotos.com -
By Case_f · Posted
"Microsoft plans to remove the MSN feed..." Yaaay, finally the horrible dumpster fire of badly translated tabloid trash is going away! Good riddance! "...and replace it with Copilot Discover..." Oh ffs... -
-
-
Recent Achievements
-
Itbob513626 earned a badge
Week One Done
-
Itbob513626 earned a badge
One Month Later
-
EdwardFranciscoVilla went up a rank
Rookie
-
MoJo624 earned a badge
Week One Done
-
aeganwn earned a badge
Collaborator
-
-
Popular Contributors
-
Tell a friend
Question
sanjay kothari
I have written a simple program which receive data from serial port i.e (temperature) and display on a line graph. but i require accumlate the graph data upto 10 minutes on screen. after that it again accumlate next 10 minutes data.
**The Code of VB.Net program is below *
Help with Code Tags
VB.NET Syntax (Toggle Plain Text)
Imports System.Drawing.Image
Imports System.IO.Ports
Public Class frmGraph
Dim WithEvents port2 As SerialPort = _
New SerialPort("COM2", 19200, Parity.Even, 7, StopBits.One)
' Variables to store the changing values to be charted (previous and current)
Private OldValue As Single = 0
Private NewValue As Single = 0
Dim XMove As Integer = 4
Dim Chunks As Integer = 10
Private Sub frmGraph_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
SwitchMT500()
ReadLineAddress()
txtMin.Text = 620
txtMax.Text = 630
' Paint Guidelines on picGraph
picGraph.Image = DisplayGuidelines(picGraph, Chunks)
' Paint Guidelines and Numbers on picValues
picValues.Image = Me.DisplayVerticalValues(picValues, Chunks, CInt(txtMin.Text), CInt(txtMax.Text))
ReadTemperature()
End Sub
Private Function DisplayGuidelines(ByVal PicBox As PictureBox, ByVal chunks As Integer) As Bitmap
' Step 1
' Create a bitmap to draw on and grab its Graphics Object
Dim bm As New Bitmap(PicBox.Width, PicBox.Height)
Dim gr As Graphics = Graphics.FromImage(bm)
' Step 2
' Draw guidelines on main chart.
' Get the total height available and split it into chunks
Dim total As Integer = PicBox.Height
Dim chunk As Single = total / chunks
' Step 3
For i As Single = chunk To total Step chunk
gr.DrawLine(Pens.WhiteSmoke, 0, i, PicBox.Width, i)
Next i
' Step 4
' return the results.
Return bm
' Step 5
gr.Dispose()
End Function
Private Function DisplayVerticalValues(ByVal PB As PictureBox, ByVal HowManyChunks As Single, _
ByVal MinValue As Single, ByVal MaxValue As Single) As Bitmap
' Step 1
Dim bmp As New Bitmap(PB.Width, PB.Height)
Dim gv As Graphics = Graphics.FromImage(bmp)
' Step 2
' Draw guidelines on values strip
' Get the total height available and split it into chunks
' This value represents a number of pixels
Dim TotalPixels As Integer = PB.Height
Dim SingleChunk As Single = TotalPixels / HowManyChunks
For i As Single = SingleChunk To TotalPixels Step SingleChunk
gv.DrawLine(Pens.WhiteSmoke, 0, i, PB.Width, i)
Next i
' Step 3
' Draw Numbers as Text, correctly spaced vertically
' Begin with the highest value allowed
Dim NextMarker As Integer = MaxValue
' Calculate the plottable range
Dim ValueRange As Integer = MaxValue - MinValue
' Draw the numbers, decrementing values proportionately each time through the loop
For i As Single = 0 To TotalPixels Step SingleChunk
gv.DrawString(CStr(NextMarker), New Font("Verdana", 8, FontStyle.Regular), Brushes.Black, 1, i)
NextMarker -= (ValueRange / HowManyChunks)
Next
' Step 4
Return bmp
' Step 5
gv.Dispose()
End Function
Private Function DisplayGuidelinesAndChart(ByVal PicBox As PictureBox, ByVal chunks As Integer, _
ByVal XMove As Integer, ByVal NewValue As Single, ByVal Min As Single, ByVal Max As Single) As Bitmap
' Step 1
' Grab the current image (the latest version of the chart)
Dim bm As New Bitmap(PicBox.Width, PicBox.Height)
Dim gr As Graphics = Graphics.FromImage(bm)
' Step 2
' Get the total height available and split it into chunks
Dim total As Integer = PicBox.Height
Dim chunk As Single = total / chunks
' Tack missing guidelines to right hand side on the Graphics object.
For i As Single = chunk To total Step chunk
gr.DrawLine(Pens.WhiteSmoke, PicBox.Width - XMove, i, PicBox.Width, i)
Next i
' Step 3
' Draw this grabbed image, placing it XMove pixels to the left
If Not IsNothing(PicBox.Image) Then
gr.DrawImage(PicBox.Image, -XMove, 0)
End If
' Step 4
' Plot the new value.
' Calculate the scaling required to make full use of the height of
' the PictureBox
Dim ValueRange As Single = Max - Min
Dim vScale As Single = PicBox.Height / ValueRange
' Apply the scale to the current value
NewValue *= vScale
' Step 5
' Shift start point from top left to bottom left.
gr.TranslateTransform(0, PicBox.Height)
' Step 6
' Draw the next line segment on the Graphics object.
' If Min is > 0 then you need to shift the drawing down once again,
' this time to put the Min value on the horizontal axis
If Min > 0 Then gr.TranslateTransform(0, Min * vScale)
Dim p As Pen = New Pen(Color.Navy, 1)
gr.DrawLine(p, _
PicBox.Width - 1 - XMove, -OldValue, _
PicBox.Width - 1, -NewValue)
OldValue = NewValue
' Step 7
' Return the Bitmap .
Return bm
' Calculate length of baseline drawn by the code above
BaseLineLength = PicBox.Width
' Calculate the width of each line segment
LineWidth = (BaseLineLength / Sales.ToArray.Length)
' Step 8
' All done
gr.Dispose()
End Function
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
picValues.Image = Me.DisplayVerticalValues(picValues, Chunks, CInt(txtMin.Text), CInt(txtMax.Text))
ReadTemperature()
End Sub
Private Function ReadTemperature()
Dim strValue as string
strValue = port2.ReadExisting
'picGraph.Image = DisplayGuidelinesAndChart(picGraph, Chunks, XMove, strvalue, CInt(txtMin.Text), CInt(txtMax.Text))
picGraph.Image = DisplayGuidelinesAndChart(picGraph, Chunks, XMove, strvalue, CInt(txtMin.Text), CInt(txtMax.Text))
lblValue.Text = strvalue
End Function
End Class
Kindly provide code or functions so that i accumulate reading data from serial port on graph upto 10 minutes.
Link to comment
https://www.neowin.net/forum/topic/871282-vbnet-create-a-graphicspath-to-hold-the-line-info/Share on other sites
1 answer to this question
Recommended Posts