Hirdetés
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- Magga: PLEX: multimédia az egész lakásban
- GoodSpeed: Te hány éves vagy?
- Luck Dragon: Alza kuponok – aktuális kedvezmények, tippek és tapasztalatok (külön igényre)
- sziku69: Szólánc.
- laskr99: Processzor és videokártya szilícium mag fotók újratöltve!
- gban: Ingyen kellene, de tegnapra
- vrob: Próbálkozás 386 alaplap újraélesztésre
- Luck Dragon: Asszociációs játék. :)
- ldave: New Game Blitz - 2026
-
LOGOUT
A Microsoft Excel topic célja segítséget kérni és nyújtani Excellel kapcsolatos problémákra.
Kérdés felvetése előtt olvasd el, ha még nem tetted.
Új hozzászólás Aktív témák
-
VANESSZA1
őstag
Ezt a makró diagrammot hogyan tudom egy Excel táblába betenni?
Private addDataRunner As Thread
Private rand As New Random()
Private chart1 As Dundas.Charting.WinControl.Chart
Public Delegate Sub AddDataDelegate()
Public addDataDel As AddDataDelegate
...Private Sub RealTimeSample_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
Dim addDataThreadStart As New ThreadStart(AddressOf AddDataThreadLoop)
addDataRunner = New Thread(addDataThreadStart)addDataDel = New AddDataDelegate(AddressOf AddData)
End Sub 'RealTimeSample_Load
Private Sub startTrending_Click(sender As Object, e As System.EventArgs) Handles startTrending.Click
' Disable all controls on the form
startTrending.Enabled = False
' and only Enable the Stop button
stopTrending.Enabled = True' Predefine the viewing area of the chart
minValue = DateTime.Now
maxValue = minValue.AddSeconds(120)chart1.ChartAreas(0).AxisX.Minimum = minValue.ToOADate()
chart1.ChartAreas(0).AxisX.Maximum = maxValue.ToOADate()' Reset number of series in the chart.
chart1.Series.Clear()' create a line chart series
Dim newSeries As New Series("Series1")
newSeries.Type = SeriesChartType.Line
newSeries.BorderWidth = 2
newSeries.Color = Color.OrangeRed
newSeries.XValueType = ChartValueTypes.DateTime
chart1.Series.Add(newSeries)' start worker threads.
If addDataRunner.IsAlive = True Then
addDataRunner.Resume()
Else
addDataRunner.Start()
End If
End Sub 'startTrending_ClickPrivate Sub stopTrending_Click(sender As Object, e As System.EventArgs) Handles stopTrending.Click
If addDataRunner.IsAlive = True Then
addDataRunner.Suspend()
End If' Enable all controls on the form
startTrending.Enabled = True
' and only Disable the Stop button
stopTrending.Enabled = False
End Sub 'stopTrending_Click'/ Main loop for the thread that adds data to the chart.
'/ The main purpose of this function is to Invoke AddData
'/ function every 1000ms (1 second).
Private Sub AddDataThreadLoop()
While True
chart1.Invoke(addDataDel)Thread.Sleep(1000)
End While
End Sub 'AddDataThreadLoopPublic Sub AddData()
Dim timeStamp As DateTime = DateTime.NowDim ptSeries As Series
For Each ptSeries In chart1.Series
AddNewPoint(timeStamp, ptSeries)
Next ptSeries
End Sub 'AddData'/ The AddNewPoint function is called for each series in the chart when
'/ new points need to be added. The new point will be placed at specified
'/ X axis (Date/Time) position with a Y value in a range +/- 1 from the previous
'/ data point's Y value, and not smaller than zero.
Public Sub AddNewPoint(timeStamp As DateTime, ptSeries As Dundas.Charting.WinControl.Series)
Dim newVal As Double = 0If ptSeries.Points.Count > 0 Then
newVal = ptSeries.Points((ptSeries.Points.Count - 1)).YValues(0) +(rand.NextDouble() * 2 - 1)
End IfIf newVal < 0 Then
newVal = 0
End If
' Add new data point to its series.
ptSeries.Points.AddXY(timeStamp.ToOADate(), rand.Next(10, 20))' remove all points from the source series older than 1.5 minutes.
Dim removeBefore As Double = timeStamp.AddSeconds((CDbl(90) * - 1)).ToOADate()
'remove oldest values to maintain a constant number of data points
While ptSeries.Points(0).XValue < removeBefore
ptSeries.Points.RemoveAt(0)
End Whilechart1.ChartAreas(0).AxisX.Minimum = ptSeries.Points(0).XValue
chart1.ChartAreas(0).AxisX.Maximum = DateTime.FromOADate(ptSeries.Points(0).XValue).AddMinutes(2).ToOADate()chart1.Invalidate()
End Sub 'AddNewPoint'/ Clean up any resources being used.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If(addDataRunner.ThreadState And ThreadState.Suspended) = ThreadState.Suspended Then
addDataRunner.Resume()
End If
addDataRunner.Abort()If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub 'Dispose
Új hozzászólás Aktív témák
- MIUI / HyperOS topik
- Gaming notebook topik
- CES 2026: Színre lép a Motorola Razr Fold
- HiFi műszaki szemmel - sztereó hangrendszerek
- Battlefield 6
- CES 2026: Főhajtás a Moto 360 előtt Polar funkciókkal
- CES 2026: nagy újítást hoz az érkező AMD EPYC
- Google Pixel 9 Pro XL - hét szűk esztendő
- Okos Otthon / Smart Home
- OnePlus 15 - van plusz energia
- További aktív témák...
- iPhone 16 128 GB Plus White - Bontatlan !! www.stylebolt.hu - Apple eszközök és tartozékok !!
- iPhone XS Max 256GB Black -1 ÉV GARANCIA - Kártyafüggetlen, MS3997
- GYÖNYÖRŰ iPhone 13 Mini 128GB Green- 1 ÉV GARANCIA -Kártyafüggetlen, MS4200
- LG UltraGear Gaming Monitorok -30%
- Bomba ár! HP EliteBook 820 G1 - i5-4GEN I 8GB I 500GB I 12,5" HD I Cam I W10 I Garancia!
Állásajánlatok
Cég: Laptopszaki Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Fferi50
