Graph_Bar.ctl 利用MSChart制作的用户控件
Form1.frm 示例文件后台代码
GraphBar.xls OCX用户控件说明文档
Graph_Bar
Rem 公共属性
Private str_Graph_Name As String
Private long_Graph_Width As Long
Private long_Graph_Height As Long
Private str_Y_Name As String
Private int_Y_Min As Integer
Private int_Y_Max As Integer
Private int_Y_Step As Integer
Private str_X_Name As String
Private array_X_Values() As String
Private array_Part_Values() As String
Private array_Total_Values() As String
Private array_Goal_Values() As String
Private str_Part_Name1 As String
Private str_Part_Name2 As String
Private str_Total_Name As String
Private str_Part_Color1 As String
Private str_Part_Color2 As String
Private str_Total_Color As String
Rem 私有変数
Private str_C1_Name As String
Private array_C1_Values() As Integer
Private array_C1_Color() As String
Private str_C2_Name As String
Private array_C2_Values() As Integer
Private array_C2_Color() As String
Private str_C3_Name As String
Private array_C3_Values() As Integer
Private array_C3_Color() As String
Private array_Values() As Integer
Private int_Y_Maj As Integer
Private int_Y_Near_Max As Integer
Rem 公共属性
Public Property Get()Property Get Graph_Name() As String
Graph_Name = str_Graph_Name
End Property
Public Property Let()Property Let Graph_Name(ByVal value As String)
str_Graph_Name = value
End Property
Public Property Get()Property Get Graph_Width() As Long
Graph_Width = long_Graph_Width
End Property
Public Property Let()Property Let Graph_Width(ByVal value As Long)
long_Graph_Width = value
End Property
Public Property Get()Property Get Graph_Height() As Long
Graph_Height = long_Graph_Height
End Property
Public Property Let()Property Let Graph_Height(ByVal value As Long)
long_Graph_Height = value
End Property
Public Property Get()Property Get Y_Name() As String
Y_Name = str_Y_Name
End Property
Public Property Let()Property Let Y_Name(ByVal value As String)
str_Y_Name = value
End Property
Public Property Get()Property Get Y_Min() As Integer
Y_Min = int_Y_Min
End Property
Public Property Let()Property Let Y_Min(ByVal value As Integer)
int_Y_Min = value
End Property
Public Property Get()Property Get Y_Max() As Integer
Y_Max = int_Y_Max
End Property
Public Property Let()Property Let Y_Max(ByVal value As Integer)
int_Y_Max = value
End Property
Public Property Get()Property Get Y_Step() As Integer
Y_Step = int_Y_Step
End Property
Public Property Let()Property Let Y_Step(ByVal value As Integer)
int_Y_Step = value
End Property
Public Property Get()Property Get X_Name() As String
X_Name = str_X_Name
End Property
Public Property Let()Property Let X_Name(ByVal value As String)
str_X_Name = value
End Property
Public Property Get()Property Get X_Values() As Variant
X_Values = array_X_Values
End Property
Public Property Let()Property Let X_Values(ByRef value As Variant)
array_X_Values = value
End Property
Public Property Get()Property Get Part_Name1() As String
Part_Name1 = str_Part_Name1
End Property
Public Property Let()Property Let Part_Name1(ByVal value As String)
str_Part_Name1 = value
End Property
Public Property Get()Property Get Part_Values() As Variant
Part_Values = array_Part_Values
End Property
Public Property Let()Property Let Part_Values(ByRef value As Variant)
array_Part_Values = value
End Property
Public Property Get()Property Get Part_Color1() As String
Part_Color1 = str_Part_Color1
End Property
Public Property Let()Property Let Part_Color1(ByVal value As String)
str_Part_Color1 = value
End Property
Public Property Get()Property Get Part_Name2() As String
Part_Name2 = str_Part_Name2
End Property
Public Property Let()Property Let Part_Name2(ByVal value As String)
str_Part_Name2 = value
End Property
Public Property Get()Property Get Part_Color2() As String
Part_Color2 = str_Part_Color2
End Property
Public Property Let()Property Let Part_Color2(ByVal value As String)
str_Part_Color2 = value
End Property
Public Property Get()Property Get Total_Name() As String
Total_Name = str_Total_Name
End Property
Public Property Let()Property Let Total_Name(ByVal value As String)
str_Total_Name = value
End Property
Public Property Get()Property Get Total_Values() As Variant
Total_Values = array_Total_Values
End Property
Public Property Let()Property Let Total_Values(ByRef value As Variant)
array_Total_Values = value
End Property
Public Property Get()Property Get Total_Color() As String
Total_Color = str_Total_Color
End Property
Public Property Let()Property Let Total_Color(ByVal value As String)
str_Total_Color = value
End Property
Public Property Get()Property Get Goal_Values() As Variant
Goal_Values = array_Goal_Values
End Property
Public Property Let()Property Let Goal_Values(ByRef value As Variant)
array_Goal_Values = value
End Property
Rem 初期化の関数
Private Sub UserControl_Initialize()Sub UserControl_Initialize()
MSChart1.Left = 0
MSChart1.Top = 0
MSChart1.Visible = False
'既定に設定
str_Graph_Name = "部門別在庫状況"
lon_Graph_Width = 9975
log_Graph_Height = 6975
str_Y_Name = "台数"
int_Y_Min = 0
int_Y_Max = 200
int_Y_Step = 20
str_X_Name = "部門"
str_Part_Name1 = "加修在庫(未達)"
'赤色
str_Part_Color1 = "255,0,0"
str_Part_Name2 = "加修在庫"
'青色
str_Part_Color2 = "0,0,255"
str_Total_Name = "未検車在庫"
'浅い緑色
str_Total_Color = "192,255,192"
End Sub
Rem 表示統計図の関数
Public Sub GraphShow()Sub GraphShow()
'統計図名
MSChart1.Title = str_Graph_Name
'選んではいけません
MSChart1.AllowSelections = False
'統計図のタイプを設けます
MSChart1.chartType = VtChChartType2dCombination
'積み上げます
MSChart1.Stacking = True
'Y2軸に隠れます
MSChart1.Plot.Axis(VtChAxisIdY2).AxisScale.Hide = True
'無作為のデータを使いません
MSChart1.RandomFill = False
'値をあげます
MSChart1.ChartData = Data_Prepare()
Rem X軸を設けます
MSChart1.Plot.Axis(VtChAxisIdX).AxisTitle = str_X_Name
MSChart1.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
MSChart1.RowCount = UBound(array_X_Values) + 1
For i = 1 To UBound(array_X_Values) + 1
MSChart1.DataGrid.RowLabel(i, 1) = array_X_Values(i - 1)
Next i
Rem Y軸を設けます
MSChart1.Plot.Axis(VtChAxisIdY).AxisTitle = str_Y_Name
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = int_Y_Min
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = int_Y_Near_Max
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = int_Y_Maj
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 0
Rem シリーズを設けます
MSChart1.ShowLegend = True
MSChart1.ColumnCount = 3
MSChart1.DataGrid.ColumnLabel(1, 1) = str_C1_Name
MSChart1.DataGrid.ColumnLabel(2, 1) = str_C2_Name
MSChart1.DataGrid.ColumnLabel(3, 1) = str_C3_Name
If UBound(array_X_Values) <> -1 Then
Call MSChart1.Plot.SeriesCollection.Item(1).DataPoints.Item(-1).Brush.FillColor.Set(array_C1_Color(0), array_C1_Color(1), array_C1_Color(2))
Call MSChart1.Plot.SeriesCollection.Item(2).DataPoints.Item(-1).Brush.FillColor.Set(array_C2_Color(0), array_C2_Color(1), array_C2_Color(2))
Call MSChart1.Plot.SeriesCollection.Item(3).DataPoints.Item(-1).Brush.FillColor.Set(array_C3_Color(0), array_C3_Color(1), array_C3_Color(2))
End If
Rem 統計図のサイズを設けます
MSChart1.Width = long_Graph_Width
MSChart1.Height = long_Graph_Height
UserControl.Width = long_Graph_Width
UserControl.Height = long_Graph_Height
MSChart1.Visible = True
End Sub
Rem データを用意する関数
Private Function Data_Prepare()Function Data_Prepare() As Variant
str_C1_Name = str_Part_Name1
str_C2_Name = str_Part_Name2
str_C3_Name = str_Total_Name
array_C1_Color = Split(str_Part_Color1, ",")
array_C2_Color = Split(str_Part_Color2, ",")
array_C3_Color = Split(str_Total_Color, ",")
'目盛線を計算します
int_Y_Near_Max = int_Y_Max - ((int_Y_Max - int_Y_Min) Mod int_Y_Step)
int_Y_Maj = (int_Y_Near_Max - int_Y_Min) / int_Y_Step
'タイプ転換
If UBound(array_Total_Values) <> -1 Then
ReDim array_C3_Values(UBound(array_Total_Values))
Else
ReDim array_C3_Values(0)
End If
For i = 0 To UBound(array_Total_Values)
array_C3_Values(i) = array_Total_Values(i)
Next i
'目標値によって、データを設けます
If UBound(array_Part_Values) <> -1 Then
ReDim array_C1_Values(UBound(array_Part_Values))
ReDim array_C2_Values(UBound(array_Part_Values))
Else
ReDim array_C1_Values(0)
ReDim array_C2_Values(0)
End If
For i = 0 To IIf(UBound(array_Goal_Values) < UBound(array_Part_Values), UBound(array_Goal_Values), UBound(array_Part_Values))
If CInt(array_Goal_Values(i)) >= CInt(array_Part_Values(i)) Then
array_C1_Values(i) = 0
array_C2_Values(i) = array_Part_Values(i)
Else
array_C1_Values(i) = array_Part_Values(i)
array_C2_Values(i) = 0
End If
Next i
'もし目標値がない、無限大によって処理します
If UBound(array_Part_Values) > UBound(array_Goal_Values) Then
For i = 1 To UBound(array_Part_Values) - UBound(array_Goal_Values)
array_C2_Values(UBound(array_Goal_Values) + i) = array_Part_Values(UBound(array_Goal_Values) + i)
Next i
End If
'データは表示を積み上げて、事前に処理します
For i = 0 To IIf(UBound(array_C3_Values) < UBound(array_C2_Values), UBound(array_C3_Values), UBound(array_C2_Values))
array_C3_Values(i) = array_C3_Values(i) - array_C2_Values(i)
Next i
For i = 0 To IIf(UBound(array_C3_Values) < UBound(array_C1_Values), UBound(array_C3_Values), UBound(array_C1_Values))
array_C3_Values(i) = array_C3_Values(i) - array_C1_Values(i)
Next i
'データを合併します
If UBound(array_X_Values) <> -1 Then
ReDim array_Values(UBound(array_X_Values), 2)
For i = 0 To IIf(UBound(array_C1_Values) < UBound(array_X_Values), UBound(array_C1_Values), UBound(array_X_Values))
array_Values(i, 0) = array_C1_Values(i)
Next i
For i = 0 To IIf(UBound(array_C2_Values) < UBound(array_X_Values), UBound(array_C2_Values), UBound(array_X_Values))
array_Values(i, 1) = array_C2_Values(i)
Next i
For i = 0 To IIf(UBound(array_C3_Values) < UBound(array_X_Values), UBound(array_C3_Values), UBound(array_X_Values))
array_Values(i, 2) = array_C3_Values(i)
Next i
End If
'戻り値
Data_Prepare = array_Values
End Function
Rem 公共属性
Private str_Graph_Name As String
Private long_Graph_Width As Long
Private long_Graph_Height As Long
Private str_Y_Name As String
Private int_Y_Min As Integer
Private int_Y_Max As Integer
Private int_Y_Step As Integer
Private str_X_Name As String
Private array_X_Values() As String
Private array_Part_Values() As String
Private array_Total_Values() As String
Private array_Goal_Values() As String
Private str_Part_Name1 As String
Private str_Part_Name2 As String
Private str_Total_Name As String
Private str_Part_Color1 As String
Private str_Part_Color2 As String
Private str_Total_Color As String
Rem 私有変数
Private str_C1_Name As String
Private array_C1_Values() As Integer
Private array_C1_Color() As String
Private str_C2_Name As String
Private array_C2_Values() As Integer
Private array_C2_Color() As String
Private str_C3_Name As String
Private array_C3_Values() As Integer
Private array_C3_Color() As String
Private array_Values() As Integer
Private int_Y_Maj As Integer
Private int_Y_Near_Max As Integer
Rem 公共属性
Public Property Get()Property Get Graph_Name() As String
Graph_Name = str_Graph_Name
End Property
Public Property Let()Property Let Graph_Name(ByVal value As String)
str_Graph_Name = value
End Property
Public Property Get()Property Get Graph_Width() As Long
Graph_Width = long_Graph_Width
End Property
Public Property Let()Property Let Graph_Width(ByVal value As Long)
long_Graph_Width = value
End Property
Public Property Get()Property Get Graph_Height() As Long
Graph_Height = long_Graph_Height
End Property
Public Property Let()Property Let Graph_Height(ByVal value As Long)
long_Graph_Height = value
End Property
Public Property Get()Property Get Y_Name() As String
Y_Name = str_Y_Name
End Property
Public Property Let()Property Let Y_Name(ByVal value As String)
str_Y_Name = value
End Property
Public Property Get()Property Get Y_Min() As Integer
Y_Min = int_Y_Min
End Property
Public Property Let()Property Let Y_Min(ByVal value As Integer)
int_Y_Min = value
End Property
Public Property Get()Property Get Y_Max() As Integer
Y_Max = int_Y_Max
End Property
Public Property Let()Property Let Y_Max(ByVal value As Integer)
int_Y_Max = value
End Property
Public Property Get()Property Get Y_Step() As Integer
Y_Step = int_Y_Step
End Property
Public Property Let()Property Let Y_Step(ByVal value As Integer)
int_Y_Step = value
End Property
Public Property Get()Property Get X_Name() As String
X_Name = str_X_Name
End Property
Public Property Let()Property Let X_Name(ByVal value As String)
str_X_Name = value
End Property
Public Property Get()Property Get X_Values() As Variant
X_Values = array_X_Values
End Property
Public Property Let()Property Let X_Values(ByRef value As Variant)
array_X_Values = value
End Property
Public Property Get()Property Get Part_Name1() As String
Part_Name1 = str_Part_Name1
End Property
Public Property Let()Property Let Part_Name1(ByVal value As String)
str_Part_Name1 = value
End Property
Public Property Get()Property Get Part_Values() As Variant
Part_Values = array_Part_Values
End Property
Public Property Let()Property Let Part_Values(ByRef value As Variant)
array_Part_Values = value
End Property
Public Property Get()Property Get Part_Color1() As String
Part_Color1 = str_Part_Color1
End Property
Public Property Let()Property Let Part_Color1(ByVal value As String)
str_Part_Color1 = value
End Property
Public Property Get()Property Get Part_Name2() As String
Part_Name2 = str_Part_Name2
End Property
Public Property Let()Property Let Part_Name2(ByVal value As String)
str_Part_Name2 = value
End Property
Public Property Get()Property Get Part_Color2() As String
Part_Color2 = str_Part_Color2
End Property
Public Property Let()Property Let Part_Color2(ByVal value As String)
str_Part_Color2 = value
End Property
Public Property Get()Property Get Total_Name() As String
Total_Name = str_Total_Name
End Property
Public Property Let()Property Let Total_Name(ByVal value As String)
str_Total_Name = value
End Property
Public Property Get()Property Get Total_Values() As Variant
Total_Values = array_Total_Values
End Property
Public Property Let()Property Let Total_Values(ByRef value As Variant)
array_Total_Values = value
End Property
Public Property Get()Property Get Total_Color() As String
Total_Color = str_Total_Color
End Property
Public Property Let()Property Let Total_Color(ByVal value As String)
str_Total_Color = value
End Property
Public Property Get()Property Get Goal_Values() As Variant
Goal_Values = array_Goal_Values
End Property
Public Property Let()Property Let Goal_Values(ByRef value As Variant)
array_Goal_Values = value
End Property
Rem 初期化の関数
Private Sub UserControl_Initialize()Sub UserControl_Initialize()
MSChart1.Left = 0
MSChart1.Top = 0
MSChart1.Visible = False
'既定に設定
str_Graph_Name = "部門別在庫状況"
lon_Graph_Width = 9975
log_Graph_Height = 6975
str_Y_Name = "台数"
int_Y_Min = 0
int_Y_Max = 200
int_Y_Step = 20
str_X_Name = "部門"
str_Part_Name1 = "加修在庫(未達)"
'赤色
str_Part_Color1 = "255,0,0"
str_Part_Name2 = "加修在庫"
'青色
str_Part_Color2 = "0,0,255"
str_Total_Name = "未検車在庫"
'浅い緑色
str_Total_Color = "192,255,192"
End Sub
Rem 表示統計図の関数
Public Sub GraphShow()Sub GraphShow()
'統計図名
MSChart1.Title = str_Graph_Name
'選んではいけません
MSChart1.AllowSelections = False
'統計図のタイプを設けます
MSChart1.chartType = VtChChartType2dCombination
'積み上げます
MSChart1.Stacking = True
'Y2軸に隠れます
MSChart1.Plot.Axis(VtChAxisIdY2).AxisScale.Hide = True
'無作為のデータを使いません
MSChart1.RandomFill = False
'値をあげます
MSChart1.ChartData = Data_Prepare()
Rem X軸を設けます
MSChart1.Plot.Axis(VtChAxisIdX).AxisTitle = str_X_Name
MSChart1.Plot.Axis(VtChAxisIdX).ValueScale.Auto = False
MSChart1.RowCount = UBound(array_X_Values) + 1
For i = 1 To UBound(array_X_Values) + 1
MSChart1.DataGrid.RowLabel(i, 1) = array_X_Values(i - 1)
Next i
Rem Y軸を設けます
MSChart1.Plot.Axis(VtChAxisIdY).AxisTitle = str_Y_Name
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Auto = False
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Minimum = int_Y_Min
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.Maximum = int_Y_Near_Max
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.MajorDivision = int_Y_Maj
MSChart1.Plot.Axis(VtChAxisIdY).ValueScale.MinorDivision = 0
Rem シリーズを設けます
MSChart1.ShowLegend = True
MSChart1.ColumnCount = 3
MSChart1.DataGrid.ColumnLabel(1, 1) = str_C1_Name
MSChart1.DataGrid.ColumnLabel(2, 1) = str_C2_Name
MSChart1.DataGrid.ColumnLabel(3, 1) = str_C3_Name
If UBound(array_X_Values) <> -1 Then
Call MSChart1.Plot.SeriesCollection.Item(1).DataPoints.Item(-1).Brush.FillColor.Set(array_C1_Color(0), array_C1_Color(1), array_C1_Color(2))
Call MSChart1.Plot.SeriesCollection.Item(2).DataPoints.Item(-1).Brush.FillColor.Set(array_C2_Color(0), array_C2_Color(1), array_C2_Color(2))
Call MSChart1.Plot.SeriesCollection.Item(3).DataPoints.Item(-1).Brush.FillColor.Set(array_C3_Color(0), array_C3_Color(1), array_C3_Color(2))
End If
Rem 統計図のサイズを設けます
MSChart1.Width = long_Graph_Width
MSChart1.Height = long_Graph_Height
UserControl.Width = long_Graph_Width
UserControl.Height = long_Graph_Height
MSChart1.Visible = True
End Sub
Rem データを用意する関数
Private Function Data_Prepare()Function Data_Prepare() As Variant
str_C1_Name = str_Part_Name1
str_C2_Name = str_Part_Name2
str_C3_Name = str_Total_Name
array_C1_Color = Split(str_Part_Color1, ",")
array_C2_Color = Split(str_Part_Color2, ",")
array_C3_Color = Split(str_Total_Color, ",")
'目盛線を計算します
int_Y_Near_Max = int_Y_Max - ((int_Y_Max - int_Y_Min) Mod int_Y_Step)
int_Y_Maj = (int_Y_Near_Max - int_Y_Min) / int_Y_Step
'タイプ転換
If UBound(array_Total_Values) <> -1 Then
ReDim array_C3_Values(UBound(array_Total_Values))
Else
ReDim array_C3_Values(0)
End If
For i = 0 To UBound(array_Total_Values)
array_C3_Values(i) = array_Total_Values(i)
Next i
'目標値によって、データを設けます
If UBound(array_Part_Values) <> -1 Then
ReDim array_C1_Values(UBound(array_Part_Values))
ReDim array_C2_Values(UBound(array_Part_Values))
Else
ReDim array_C1_Values(0)
ReDim array_C2_Values(0)
End If
For i = 0 To IIf(UBound(array_Goal_Values) < UBound(array_Part_Values), UBound(array_Goal_Values), UBound(array_Part_Values))
If CInt(array_Goal_Values(i)) >= CInt(array_Part_Values(i)) Then
array_C1_Values(i) = 0
array_C2_Values(i) = array_Part_Values(i)
Else
array_C1_Values(i) = array_Part_Values(i)
array_C2_Values(i) = 0
End If
Next i
'もし目標値がない、無限大によって処理します
If UBound(array_Part_Values) > UBound(array_Goal_Values) Then
For i = 1 To UBound(array_Part_Values) - UBound(array_Goal_Values)
array_C2_Values(UBound(array_Goal_Values) + i) = array_Part_Values(UBound(array_Goal_Values) + i)
Next i
End If
'データは表示を積み上げて、事前に処理します
For i = 0 To IIf(UBound(array_C3_Values) < UBound(array_C2_Values), UBound(array_C3_Values), UBound(array_C2_Values))
array_C3_Values(i) = array_C3_Values(i) - array_C2_Values(i)
Next i
For i = 0 To IIf(UBound(array_C3_Values) < UBound(array_C1_Values), UBound(array_C3_Values), UBound(array_C1_Values))
array_C3_Values(i) = array_C3_Values(i) - array_C1_Values(i)
Next i
'データを合併します
If UBound(array_X_Values) <> -1 Then
ReDim array_Values(UBound(array_X_Values), 2)
For i = 0 To IIf(UBound(array_C1_Values) < UBound(array_X_Values), UBound(array_C1_Values), UBound(array_X_Values))
array_Values(i, 0) = array_C1_Values(i)
Next i
For i = 0 To IIf(UBound(array_C2_Values) < UBound(array_X_Values), UBound(array_C2_Values), UBound(array_X_Values))
array_Values(i, 1) = array_C2_Values(i)
Next i
For i = 0 To IIf(UBound(array_C3_Values) < UBound(array_X_Values), UBound(array_C3_Values), UBound(array_X_Values))
array_Values(i, 2) = array_C3_Values(i)
Next i
End If
'戻り値
Data_Prepare = array_Values
End Function
Form1.frm 示例文件后台代码
Form1
Dim Graph_Name As String
Dim Graph_Width As Long
Dim Graph_Height As Long
Dim Y_Name As String
Dim Y_Min As Integer
Dim Y_Max As Integer
Dim Y_Step As Integer
Dim X_Name As String
Dim array_X_Values() As String
Dim Part_Name1 As String
Dim array_Part_Values() As String
Dim str_Part_Color1 As String
Dim Part_Name2 As String
Dim array_Total_Values() As String
Dim str_Part_Color2 As String
Dim Total_Name As String
Dim array_Goal_Values() As String
Dim str_Total_Color As String
Private Sub Command1_Click()Sub Command1_Click()
Rem データを用意します
Graph_Name = Text_Graph_Name.Text
Graph_Width = Text_Graph_Width.Text
Graph_Height = Text_Graph_Height.Text
Y_Name = Text_Y_Name.Text
Y_Min = Text_Y_Min.Text
Y_Max = Text_Y_Max.Text
Y_Step = Text_Y_Step.Text
X_Name = Text_X_Name.Text
array_X_Values = Split(Text_X_Values.Text, ",")
Part_Name1 = Text_Part_Name1.Text
array_Part_Values = Split(Text_Part_Values.Text, ",")
str_Part_Color1 = Text_Part_Color1.Text
Part_Name2 = Text_Part_Name2.Text
array_Total_Values = Split(Text_Total_Values.Text, ",")
str_Part_Color2 = Text_Part_Color2.Text
Total_Name = Text_Total_Name.Text
array_Goal_Values = Split(Text_Goal_Values.Text, ",")
str_Total_Color = Text_Total_Color.Text
Rem コンポーネントに値を代入すります
Graph1.Graph_Name = Graph_Name
Graph1.Graph_Width = Graph_Width
Graph1.Graph_Height = Graph_Height
Graph1.Y_Name = Y_Name
Graph1.Y_Min = Y_Min
Graph1.Y_Max = Y_Max
Graph1.Y_Step = Y_Step
Graph1.X_Name = X_Name
Graph1.X_Values = array_X_Values
Graph1.Part_Name1 = Part_Name1
Graph1.Part_Values = array_Part_Values
Graph1.Part_Color1 = str_Part_Color1
Graph1.Part_Name2 = Part_Name2
Graph1.Total_Values = array_Total_Values
Graph1.Part_Color2 = str_Part_Color2
Graph1.Total_Name = Total_Name
Graph1.Goal_Values = array_Goal_Values
Graph1.Total_Color = str_Total_Color
Rem 統計図を表示すります
Call Graph1.GraphShow
End Sub
Private Sub Form_Load()Sub Form_Load()
End Sub
Dim Graph_Name As String
Dim Graph_Width As Long
Dim Graph_Height As Long
Dim Y_Name As String
Dim Y_Min As Integer
Dim Y_Max As Integer
Dim Y_Step As Integer
Dim X_Name As String
Dim array_X_Values() As String
Dim Part_Name1 As String
Dim array_Part_Values() As String
Dim str_Part_Color1 As String
Dim Part_Name2 As String
Dim array_Total_Values() As String
Dim str_Part_Color2 As String
Dim Total_Name As String
Dim array_Goal_Values() As String
Dim str_Total_Color As String
Private Sub Command1_Click()Sub Command1_Click()
Rem データを用意します
Graph_Name = Text_Graph_Name.Text
Graph_Width = Text_Graph_Width.Text
Graph_Height = Text_Graph_Height.Text
Y_Name = Text_Y_Name.Text
Y_Min = Text_Y_Min.Text
Y_Max = Text_Y_Max.Text
Y_Step = Text_Y_Step.Text
X_Name = Text_X_Name.Text
array_X_Values = Split(Text_X_Values.Text, ",")
Part_Name1 = Text_Part_Name1.Text
array_Part_Values = Split(Text_Part_Values.Text, ",")
str_Part_Color1 = Text_Part_Color1.Text
Part_Name2 = Text_Part_Name2.Text
array_Total_Values = Split(Text_Total_Values.Text, ",")
str_Part_Color2 = Text_Part_Color2.Text
Total_Name = Text_Total_Name.Text
array_Goal_Values = Split(Text_Goal_Values.Text, ",")
str_Total_Color = Text_Total_Color.Text
Rem コンポーネントに値を代入すります
Graph1.Graph_Name = Graph_Name
Graph1.Graph_Width = Graph_Width
Graph1.Graph_Height = Graph_Height
Graph1.Y_Name = Y_Name
Graph1.Y_Min = Y_Min
Graph1.Y_Max = Y_Max
Graph1.Y_Step = Y_Step
Graph1.X_Name = X_Name
Graph1.X_Values = array_X_Values
Graph1.Part_Name1 = Part_Name1
Graph1.Part_Values = array_Part_Values
Graph1.Part_Color1 = str_Part_Color1
Graph1.Part_Name2 = Part_Name2
Graph1.Total_Values = array_Total_Values
Graph1.Part_Color2 = str_Part_Color2
Graph1.Total_Name = Total_Name
Graph1.Goal_Values = array_Goal_Values
Graph1.Total_Color = str_Total_Color
Rem 統計図を表示すります
Call Graph1.GraphShow
End Sub
Private Sub Form_Load()Sub Form_Load()
End Sub
GraphBar.xls OCX用户控件说明文档
GraphBar.xls
Graph_Bar クラス
統計図を表しています。
カスタムパブリック プロパティ:
属性名 タイプ 既定値 説明
Graph_Name String 部門別在庫状況 統計図の名称を取得または設定します。
Graph_Width Long 9975 統計図の幅を取得または設定します。
Graph_Height Long 6975 統計図の高さを取得または設定します。
Y_Name String 台数 Y軸の名称を取得または設定します。
Y_Min Integer 0 Y軸の最小値を取得または設定します。
Y_Max Integer 200 Y軸の最大値を取得または設定します。
Y_Step Integer 20 Y軸の目盛を取得または設定します。
X_Name String 部門 X軸の名称を取得または設定します。
X_Values String配列 なし X軸の値を取得または設定します。
Part_Name1 String 加修在庫(未達) 系列1の名称1を取得または設定します。
Part_Color1 String 255,0,0 系列1の色1を取得または設定します。
Part_Name2 String 加修在庫 系列1の名称2を取得または設定します。
Part_Color2 String 0,0,255 系列1の色2を取得または設定します。
Part_Values String配列 なし 系列1の値を取得または設定します。
Goal_Values String配列 なし 目標値を取得または設定します。
Total_Name String 未検車在庫 系列2の名称を取得または設定します。
Total_Color String 192,255,192 系列2の色を取得または設定します。
Total_Values String配列 なし 系列2の値を取得または設定します。
カスタムパブリック メソッド:
方法名 パラメーター 戻り値 機能
GraphShow なし なし 統計図を表示すります
注意事項:
①コンポーネントファイル名は<GraphBar.ocx>です。(プログラムを配布する時、なくなってはいけません。)
②支持を提供するファイル名は<mschrt20.ocx>です。(プログラムを配布する時、なくなってはいけません。)
Graph_Bar クラス
統計図を表しています。
カスタムパブリック プロパティ:
属性名 タイプ 既定値 説明
Graph_Name String 部門別在庫状況 統計図の名称を取得または設定します。
Graph_Width Long 9975 統計図の幅を取得または設定します。
Graph_Height Long 6975 統計図の高さを取得または設定します。
Y_Name String 台数 Y軸の名称を取得または設定します。
Y_Min Integer 0 Y軸の最小値を取得または設定します。
Y_Max Integer 200 Y軸の最大値を取得または設定します。
Y_Step Integer 20 Y軸の目盛を取得または設定します。
X_Name String 部門 X軸の名称を取得または設定します。
X_Values String配列 なし X軸の値を取得または設定します。
Part_Name1 String 加修在庫(未達) 系列1の名称1を取得または設定します。
Part_Color1 String 255,0,0 系列1の色1を取得または設定します。
Part_Name2 String 加修在庫 系列1の名称2を取得または設定します。
Part_Color2 String 0,0,255 系列1の色2を取得または設定します。
Part_Values String配列 なし 系列1の値を取得または設定します。
Goal_Values String配列 なし 目標値を取得または設定します。
Total_Name String 未検車在庫 系列2の名称を取得または設定します。
Total_Color String 192,255,192 系列2の色を取得または設定します。
Total_Values String配列 なし 系列2の値を取得または設定します。
カスタムパブリック メソッド:
方法名 パラメーター 戻り値 機能
GraphShow なし なし 統計図を表示すります
注意事項:
①コンポーネントファイル名は<GraphBar.ocx>です。(プログラムを配布する時、なくなってはいけません。)
②支持を提供するファイル名は<mschrt20.ocx>です。(プログラムを配布する時、なくなってはいけません。)