Home > Software engineering >  Visualization in mschart control on the contents of the database
Visualization in mschart control on the contents of the database

Time:09-25

There is now a form, a database connection using adodc, some inventory information in the database, to the inventory of the database graph visualization should do?
(I am using adodc connect to the database because of not using database code to create connections, only in this way),


CodePudding user response:


Adodc1 control + + Combo1 MSChart1 control control, statistics sales procedure done, if you need to add 265 304 33 92 penguins, ready to have no way to upload the project file,

CodePudding user response:

This is the data table content

CodePudding user response:

Sorry, no QQ? Can I have any WeChat, WeChat Fuselage7 or my email is [email protected]
Thank you very much

CodePudding user response:

refer to the second floor ZHRXJR response:
this is the data table content

Sorry, no QQ? Can I have any WeChat, WeChat is Fuselage7 & amp; nbsp; & nbsp; & nbsp; & nbsp; Or my email is [email protected] & lt; Br/& gt;
Thank you very much

CodePudding user response:

Sets the data source at the MSChart ADODC attributes you try,

CodePudding user response:

There is no way, give you code, thinking about yourself, first in the general section defines a array,
 Dim AA (0 To 3) As String 

Started, and the Combo1 control load "product name",
 Private Sub Form_Load () 
Label1. Caption=""
Adodc1. The ConnectionString="Provider=Microsoft. ACE. The OLEDB. 12.0; Data Source="& amp; App. The Path & amp; "\ 123. Accdb
"Adodc1. RecordSource="select the product name from product sales"
Adodc1. Refresh
Combo1. Clear
Combo1. AddItem "all"
EOF 'to search for the Do While Not Adodc1. You.
For I=0 To Combo1. ListCount - 1
If Combo1. List (I)=Adodc1. You. Fields (0) Then the Exit For
Next
If I=Combo1. ListCount Then Combo1. AddItem Adodc1. You. Fields (0)
Adodc1. You. MoveNext
Loop
AA (0)="hard" : AA (1)="graphics card" : AA (2)="CPU" : AA (3)="memory"
Dim X As Integer
For X=0 To 3
With MSChart1
RowCount=UBound (AA) + 1
. The Row=X + 1
. The ColumnCount=1
If X=0 Then
.data=https://bbs.csdn.net/topics/100
ElseIf X=1 Then
.data=https://bbs.csdn.net/topics/200
ElseIf X=2 Then
.data=https://bbs.csdn.net/topics/50
ElseIf X=3 Then
.data=https://bbs.csdn.net/topics/420
End the If
. RowLabel=AA (X)
End With
Next X
Label1. Caption="MSChart1 preview control"
End Sub

The click event of Combo1, display charts,
 Private Sub Combo1_Click () 
Dim CP As String, XSE0 As Long, XSE1 As Long, XSE2 As Long, XSE3 As Long, MT As Integer
CP=Combo1. Text
If the CP="all" Then
Adodc1. RecordSource="select * from product sales"
The Else
Adodc1. RecordSource="select * from product sales Where name='" & amp; CP & amp; "'
"End the If
Adodc1. Refresh
The Do While Not Adodc1. You. EOF
If Adodc1. You. Fields (" product name ")="hard" Then
XSE0=XSE0 + Adodc1. You. Fields (" sales amount ")
ElseIf Adodc1. You. Fields (" product name ")="graphics card" Then
XSE1=XSE1 + Adodc1. You. Fields (" sales amount ")
ElseIf Adodc1. You. Fields (" product name ")="CPU" Then
XSE2=XSE2 + Adodc1. You. Fields (" sales amount ")
ElseIf Adodc1. You. Fields (" product name ")="memory" Then
XSE3=XSE3 + Adodc1. You. Fields (" sales amount ")
End the If
Adodc1. You. MoveNext
Loop
Label1. Caption=CP & amp; Is the total sales ", "& amp; XSE0 + XSE1 + XSE2 + XSE3
Dim X As Integer
For X=0 To 3
With MSChart1
RowCount=UBound (AA) + 1
. The Row=X + 1
. The ColumnCount=1
If X=0 Then
.data=https://bbs.csdn.net/topics/XSE0
ElseIf X=1 Then
.data=https://bbs.csdn.net/topics/XSE1
ElseIf X=2 Then
.data=https://bbs.csdn.net/topics/XSE2
ElseIf X=3 Then
.data=https://bbs.csdn.net/topics/XSE3
End the If
. RowLabel=AA (X)
End With
Next X
End Sub

CodePudding user response:

Data table to you, in front of the database Access 2007, if you connect the database is not this, modify the connection,

CodePudding user response:

Thanks la la la la la la la la la la
  • Related