Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame
Environment: VC6 SP4, 2000 SP2
Chart Line is an ActiveX component that enables you to visualize a chart similar to the Windows NT/2000/XP Task Manager Performance chart. The component enables you to manage four lines at a time. By modifying any properties of the control, it is possible to visualize different types of charts.
The following is a demonstration of a simple application, called Chartl32. In just a few short steps, you can produce a graphic application with complete functionality.
Before you start the following tutorial, you need to Start Visual Basic and load the Chart Line custom control. For information about loading the custom control, see the Visual Basic documentation. We will use Visual Basic 6.0.
- Design the Form
- Place the Chart line control
- Place a Timer Control (set the Interval property to 400)
- Add code to the Timer control
Start by adding two controls to a blank form:
Now you can change the properties of the Chart line Control: You can change the Background color (ChartBackClor), the line Colors (Line1Color....Line4Color), or grid color (ChartForeColor). Also, you can define the range line limits of the chart (LowerRangeLine1,UpperRangeLine1...LowerRangeLine4,UpperRangeLine4).
This is easy. Most of the code goes into the Timer event:
Private Sub Timer1_Timer() Random1 = Int((20 - 15 + 1) * Rnd + 15) Random2 = Int((50 - 45 + 1) * Rnd + 45) Random3 = Int((70 - 65 + 1) * Rnd + 65) Random4 = Int((95 - 85 + 1) * Rnd + 85) 'Line 1 Call Chartl321.PlotLine(1, Random1) 'Line 2 Call Chartl321.PlotLine(2, Random2) 'Line 3 Call Chartl321.PlotLine(3, Random3) 'Line 4 Call Chartl321.PlotLine(4, Random4) 'Draw Chartl321.Draw End Sub
We have used the following two methods in this example:
Call this method to insert the new value of the line to plot on the chart into memory.
- NumLine: Specifies the number of lines to visualize
- Value: Specifies the new value to plot on the chart
Call this method to visualize the new points on the chart.
DownloadsDownload demo project - 89 Kb
Download source - 6 Kb