home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Demo / conceptdraw / data1.cab / Samples__Basic / Solutions / Diagraming / TrafficGraph / TrafficGraph.cdb < prev    next >
Text File  |  2004-02-13  |  22KB  |  444 lines

  1. '╨í╨╕╨╝╨▓╨╛╨╗, ╤ü╨╗╤â╨╢╨░╤ë╨╕╨╣ ╤Ç╨░╨╖╨┤╨╡╨╗╨╕╤é╨╡╨╗╨╡╨╝ ╨╝╨╡╨╢╨┤╤â ╨┐╨╛╨╗╤Å╨╝╨╕
  2. Const constrCharSeparator As String = ";"
  3.  
  4. '╨£╨░╤ü╤ü╨╕╨▓, ╨▓ ╨║╨╛╤é╨╛╤Ç╨╛╨╝ ╨╖╨░╨┐╨╕╤ü╤ï╨▓╨░╨╡╤é╤ü╤Å ╤é╤Ç╨░╤ä╤ä╨╕╨║ ╨╜╨░ ╨║╨░╨╢╨┤╤ï╨╣ ╨┤╨╡╨╜╤î ╨╝╨╡╤ü╤Å╤å╨░
  5. Dim adValues(30) As Double
  6.  
  7. '╨£╨░╤ü╤ê╤é╨░╨▒ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï ╨┐╨╛ ╨╛╤ü╨╕ OX. ╨Ü╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╤Ä╨╜╨╕╤é╨╛╨▓ ╨▓ ╨╡╨┤╨╕╨╜╨╕╤å╨╡ ╤ê╨║╨░╨╗╤ï. 
  8. Const condblXScale As Double = 50
  9.  
  10. '╨£╨░╨║╤ü╨╕╨╝╨░╨╗╤î╨╜╨╛╨╡ ╨╖╨╜╨░╤ç╨╡╨╜╨╕╨╡ ╨┐╨╛ ╨╛╤ü╨╕ OX, ╨║╨╛╤é╨╛╤Ç╨╛╨╡ ╨▒╤â╨┤╨╡╤é ╨╕╤ü╨┐╨╛╨╗╤î╨╖╨╛╨▓╨░╤é╤î╤ü╤Å ╨▓ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╨╡. ╨Ü╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨┤╨╜╨╡╨╣ ╨▓ ╨╝╨╡╤ü╤Å╤å╨╡.
  11. Dim intMaxX As Integer 
  12. '╨£╨░╨║╤ü╨╕╨╝╨░╨╗╤î╨╜╤ï╨╣ ╤é╤Ç╨░╤ä╤ä╨╕╨║ ╨▓ ╤é╨╡╤ç╨╡╨╜╨╕╨╡ ╨╛╨┤╨╜╨╛╨│╨╛ ╨┤╨╜╤Å ╨╖╨░ ╨╝╨╡╤ü╤Å╤å.
  13. Dim dblMaxDayTraffic As Double
  14. '╨í╤â╨╝╨╝╨░╤Ç╨╜╤ï╨╣ ╤é╤Ç╨░╤ä╤ä╨╕╨║ ╨╖╨░ ╨╝╨╡╤ü╤Å╤å.
  15. Dim dblMonthTraffic As Double
  16.  
  17. Declare Sub SelectFileAndRefreshDiagram()
  18. Declare Sub AutoRefresh()
  19. Declare Function RefreshDiagram(ByVal strTextFileName As String) As Boolean
  20. Declare Function LoadData(ByVal strFileName As String) As Boolean
  21. Declare Function DrawDiagram(ByVal strTextFileName As String) As Boolean
  22. Declare Function DrawTextBox(ByVal GroupShape As Shape, ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal strText As String, ByVal lTextSize As Long, ByVal lTextStyle As Long, ByVal intHAlign As Byte) As Shape
  23. Declare Function CalcScaleStep(ByRef dblMax As Double) As Double
  24.  
  25.  
  26. '========================================================================================================================
  27. '========================================================================================================================
  28.  
  29. '╨í╨╛╨╖╨┤╨░╨╜╨╕╨╡ ╨┐╨╛╨╗╤î╨╖╨╛╨▓╨░╤é╨╡╨╗╤î╤ü╨║╨╛╨│╨╛ ╨╝╨╡╨╜╤Ä. ╨É╨▓╤é╨╛╨╝╨░╤é╨╕╤ç╨╡╤ü╨║╨╕ ╨▓╤ï╨╖╤ï╨▓╨░╨╡╤é╤ü╤Å ╨┐╤Ç╨╕ ╨╛╤é╨║╤Ç╤ï╤é╨╕╨╕ ╨┤╨╛╨║╤â╨╝╨╡╨╜╤é╨░ ╨╕╨╖
  30. '╨╝╨░╨║╤Ç╨╛╤ü╨░ ╤â╤Ç╨╛╨▓╨╜╤Å ╨┤╨╛╨║╤â╨╝╨╡╨╜╤é╨░.
  31. Sub CreateUserMenu()
  32.     Dim custMenu As Menu
  33.     Dim newMenuItem As MenuItem
  34.     
  35.     Set custMenu = thisDoc.CustomMenu
  36.     custMenu.Caption = "Fill Di&agrams"
  37.     custMenu.RemoveAll()
  38.  
  39.     Set newMenuItem = custMenu.AddMenuItem(0)
  40.     newMenuItem.Caption = "&Select File And Refresh Diagrams"
  41.     newMenuItem.SetCmdProcessing("SelectFileAndRefreshDiagram")
  42.  
  43.     Set newMenuItem = custMenu.AddMenuItem(0)
  44.     newMenuItem.Caption = "&Refresh Diagrams"
  45.     newMenuItem.SetCmdProcessing("AutoRefresh")
  46. End Sub
  47.  
  48. '========================================================================================================================
  49. '========================================================================================================================
  50.  
  51. '╨É╨▓╤é╨╛╨╝╨░╤é╨╕╤ç╨╡╤ü╨║╨╛╨╡ ╨┐╨╛╤ü╤é╤Ç╨╛╨╡╨╜╨╕╨╡ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï ╨┐╨╛ ╨╛╨▒╨╜╨╛╨▓╨╗╨╡╨╜╨╜╤ï╨╝ ╨┤╨░╨╜╨╜╤ï╨╝ ╨▓ ╤é╨╡╨║╤ü╤é╨╛╨▓╨╛╨╝ ╤ä╨░╨╣╨╗╨╡.
  52. '╨ò╤ü╨╗╨╕ ╨╕╨╝╤Å ╤ä╨░╨╣╨╗╨░ ╤ü╨╛╤à╤Ç╨░╨╜╨╡╨╜╨╛ ╨▓ Property ╨╛╨▒╤è╨╡╨║╤é╨░ ╨╕ ╤é╨░╨║╨╛╨╣ ╤ä╨░╨╣╨╗ ╤ü╤â╤ë╨╡╤ü╤é╨▓╤â╨╡╤é, ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╨░ ╨▒╤â╨┤╨╡╤é ╨┐╨╡╤Ç╨╡╤ü╤ç╨╕╤é╨░╨╜╨░ ╨▒╨╡╨╖
  53. '╨╖╨░╨┐╤Ç╨╛╤ü╨░ ╤â ╨┐╨╛╨╗╤î╨╖╨╛╨▓╨░╤é╨╡╨╗╤Å ╨╜╨╛╨▓╨╛╨│╨╛ ╨╕╨╝╨╡╨╜╨╕ ╤ä╨░╨╣╨╗╨░ ╨┤╨░╨╜╨╜╤ï╤à.
  54. Sub AutoRefresh()
  55. On Error GoTo ErrHandler
  56.     '╨ÿ╨╝╤Å ╤ä╨░╨╣╨╗╨░ ╨┤╨░╨╜╨╜╤ï╤à
  57.     Dim strTextFileName As String
  58.     '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ Custom Property ╨╛╨▒╤è╨╡╨║╤é╨░ (╨▓ ╨╛╨┤╨╜╨╛╨╝ ╨╕╨╖ ╨╜╨╕╤à ╨╝╨╛╨╢╨╡╤é ╤à╤Ç╨░╨╜╨╕╤é╤î╤ü╤Å ╨┐╨╛╨╗╨╜╨╛╨╡ ╨╕╨╝╤Å ╤ä╨░╨╣╨╗╨░ ╨┤╨░╨╜╨╜╤ï╤à). 
  59.     Dim FileNameProp As CustomProp
  60.     Dim NextShape As Shape
  61.     Dim ActivePage As Page
  62.     Dim i As Integer
  63.     Dim j As Integer
  64.     
  65.     Set ActivePage = thisDoc.ActivePage()
  66.     
  67.     '╨ƒ╤Ç╨╛╨▓╨╡╤Ç╤Å╨╡╨╝ ╨▓╤ü╨╡ ╤ê╤ì╨╣╨┐╤ï ╨▓ ╨┤╨╛╨║╤â╨╝╨╡╨╜╤é╨╡. ╨¿╤ì╨╣╨┐, ╨▓╨╜╤â╤é╤Ç╨╕ ╨║╨╛╤é╨╛╤Ç╨╛╨│╨╛ ╨╛╨▒╨╜╨╛╨▓╨╗╤Å╨╡╤é╤ü╤Å ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╨░, 
  68.     '╤â╨╖╨╜╨░╨╡╤é╤ü╤Å ╨┐╨╛ Name.
  69.     For j=1 To ActivePage.ShapesNum()
  70.         Set NextShape = ActivePage.Shape(j)
  71.         If NextShape.Name = "DiagramDay" Then
  72.         '╨ò╤ü╨╗╨╕ ╨╜╨░╨╣╨┤╨╡╨╜ ╤ê╤ì╨╣╨┐ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï, ╨┐╤Ç╨╛╨▓╨╡╤Ç╤Å╨╡╨╝, ╤ü╨╛╤à╤Ç╨░╨╜╨╡╨╜╨╛ ╨╗╨╕ ╨▓ ╨╜╨╡╨╝ Property ╤ü ╨╕╨╝╨╡╨╜╨╡╨╝ ╤ä╨░╨╣╨╗╨░-╨╕╤ü╤é╨╛╤ç╨╜╨╕╨║╨░ ╨┤╨░╨╜╨╜╤ï╤à.
  73.             i=1
  74.             Set FileNameProp = Nothing
  75.             Do While i<=NextShape.CustomPropsNum() And FileNameProp = Nothing
  76.                 If NextShape.CustomProp(i).Label = "LastSourceFileName" Then
  77.                     Set FileNameProp = NextShape.CustomProp(i) 
  78.                     strTextFileName = FileNameProp.Value
  79.                     '╨ò╤ü╨╗╨╕ Property ╤ü╤â╤ë╨╡╤ü╤é╨▓╤â╨╡╤é, ╨╕ ╤ü╤â╤ë╨╡╤ü╤é╨▓╤â╨╡╤é ╤ä╨░╨╣╨╗, ╤â╨║╨░╨╖╨░╨╜╨╜╤ï╨╣ ╨▓ ╨╜╨╡╨╝ ╨║╨░╨║ ╨╕╤ü╤é╨╛╤ç╨╜╨╕╨║ ╨┤╨░╨╜╨╜╤ï╤à,
  80.                     '╨░╨▓╤é╨╛╨╝╨░╤é╨╕╤ç╨╡╤ü╨║╨╕ ╨╛╨▒╨╜╨╛╨▓╨╗╤Å╨╡╨╝ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤â.
  81.                     If Dir(strTextFileName) <> "" Then
  82.                          RefreshDiagram(strTextFileName)
  83.                     End If
  84.                 End If
  85.                 i = i + 1
  86.             Loop 
  87.         End If
  88.     Next
  89.     
  90.     Exit Sub
  91. ErrHandler:
  92.     MsgBox("In performing the macros, an error has occured.", cdbExclamation)
  93. End Sub
  94.  
  95. '========================================================================================================================
  96. '========================================================================================================================
  97.  
  98. '╨ù╨░╨┐╤Ç╨░╤ê╨╕╨▓╨░╨╡╨╝ ╨╕╨╝╤Å ╤ä╨░╨╣╨╗╨░-╨╕╤ü╤é╨╛╤ç╨╜╨╕╨║╨░ ╨┤╨░╨╜╨╜╤ï╤à ╨╕ ╤ü╤é╤Ç╨╛╨╕╨╝ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤â ╨╜╨░ ╨╛╤ü╨╜╨╛╨▓╨░╨╜╨╕╨╕ ╤ì╤é╨╕╤à ╨┤╨░╨╜╨╜╤ï╤à.
  99. Sub SelectFileAndRefreshDiagram()
  100. On Error GoTo ErrHandler
  101.     Dim strTextFileName As String
  102.     
  103.     '╨ƒ╤Ç╨╡╨┤╨╗╨░╨│╨░╨╡╨╝ ╨┐╨╛╨╗╤î╨╖╨╛╨▓╨░╤é╨╡╨╗╤Ä ╨▓╤ï╨▒╤Ç╨░╤é╤î ╨╕╨╝╤Å ╤ä╨░╨╣╨╗╨░ ╨┤╨░╨╜╨╜╤ï╤à
  104.     strTextFileName = GetOpenFileName("txt","Text Files")
  105.     '╨ò╤ü╨╗╨╕ ╤ä╨░╨╗ ╨▓╤ï╨▒╤Ç╨░╨╜, ╤ü╤é╤Ç╨╛╨╕╨╝ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤â.
  106.     If strTextFileName <> "" Then
  107.          RefreshDiagram(strTextFileName)
  108.     End If
  109.     Exit Sub
  110. ErrHandler:
  111.     MsgBox("In performing the macros, an error has occured.", cdbExclamation)
  112. End Sub
  113.  
  114. '========================================================================================================================
  115. '========================================================================================================================
  116.  
  117. '╨₧╨▒╨╜╨╛╨▓╨╗╤Å╨╡╨╝ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤â ╨╜╨░ ╨╛╤ü╨╜╨╛╨▓╨░╨╜╨╕╨╕ ╨┤╨░╨╜╨╜╤ï╤à ╨▓ ╤ä╨░╨╣╨╗╨╡ strTextFileName 
  118. Function RefreshDiagram(ByVal strTextFileName As String) As Boolean
  119. On Error GoTo ErrHandler
  120.     RefreshDiagram = False
  121.  
  122.     '╨ù╨░╤ç╨╕╤é╤ï╨▓╨░╨╡╨╝ ╨┤╨░╨╜╨╜╤ï╨╡ ╨╕╨╖ ╤é╨╡╨║╤ü╤é╨╛╨▓╨╛╨│╨╛ ╤ä╨░╨╣╨╗╨░ ╨╕ ╨┐╨╛╨╝╨╡╤ë╨░╨╡╨╝ ╨╕╤à ╨▓ ╨╝╨░╤ü╤ü╨╕╨▓╤ï. ╨ò╤ü╨╗╨╕ ╨▓╨╛ ╨▓╤Ç╨╡╨╝╤Å 
  123.     '╨▓╤ï╨┐╨╛╨╗╨╜╨╡╨╜╨╕╤Å ╤ä╤â╨╜╨║╤å╨╕╨╕ LoadData ╨╜╨╡ ╨┐╤Ç╨╛╨╕╨╖╨╛╤ê╨╗╨╛ ╨╛╤ê╨╕╨▒╨╛╨║...
  124.     If LoadData(strTextFileName) Then
  125.         '... ╤é╨╛ ╤ü╤é╤Ç╨╛╨╕╨╝ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤â. ╨ò╤ü╨╗╨╕ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╨░ ╨┐╨╛╤ü╤é╤Ç╨╛╨╡╨╜╨░ ╤â╤ü╨┐╨╡╤ê╨╜╨╛, ╤ü╨╛╨╛╨▒╤ë╨░╨╡╨╝ ╨╛╨▒ ╤ì╤é╨╛╨╝ ╨┐╨╛╨╗╤î╨╖╨╛╨▓╨░╤é╨╡╨╗╤Ä.
  126.         If DrawDiagram(strTextFileName) Then
  127.             RefreshDiagram = True
  128.             MsgBox("Diagramma bila uspeshno obnovlena na osnovanii dannih iz faila " & strTextFileName)
  129.         End If
  130.     End If
  131.  
  132.     Exit Function
  133. ErrHandler:
  134.     MsgBox("In performing the macros, an error has occured.", cdbExclamation)
  135. End Function
  136.  
  137. '========================================================================================================================
  138. '========================================================================================================================
  139.  
  140. '╨ù╨░╤ç╨╕╤é╤ï╨▓╨░╨╜╨╕╨╡ ╨┤╨░╨╜╨╜╤ï╤à ╨╕╨╖ ╤é╨╡╨║╤ü╤é╨╛╨▓╨╛╨│╨╛ ╤ä╨░╨╣╨╗╨░ strFileName ╨╕ ╤ü╨╛╤à╤Ç╨░╨╜╨╡╨╜╨╕╨╡ ╨╕╤à ╨▓ ╨╝╨░╤ü╤ü╨╕╨▓╨░╤à.
  141. Function LoadData(ByVal strFileName As String) As Boolean
  142. On Error GoTo ErrHandle
  143.  
  144.     Dim intFileNumber As Integer        '╨ÿ╨┤╨╡╨╜╤é╨╕╤ä╨╕╨║╨░╤é╨╛╤Ç ╨╛╨▒╤Ç╨░╨▒╨░╤é╤ï╨▓╨░╨╡╨╝╨╛╨│╨╛ ╤ä╨░╨╣╨╗╨░ ╨┤╨░╨╜╨╜╤ï╤à
  145.     Dim strLineData As String        '╨í╤é╤Ç╨╛╨║╨░, ╤ü╨╛╨┤╨╡╤Ç╨╢╨░╤ë╨░╤Å ╨╛╨┤╨╜╤â ╤ü╤é╤Ç╨╛╨║╤â ╨╕╨╖ ╤é╨╡╨║╤ü╤é╨╛╨▓╨╛╨│╨╛ ╤ä╨░╨╣╨╗╨░.
  146.     Dim intSeparatorPos As Integer    '╨ƒ╨╛╨╖╨╕╤å╨╕╤Å ╤Ç╨░╨╖╨┤╨╡╨╗╨╕╤é╨╡╨╗╤Å ╨┤╨░╨╜╨╜╤ï╤à ╤ü╤é╤Ç╨╛╨║╨╕
  147.     Dim fNoError As Boolean            '╨ñ╨╗╨░╨│, ╨┐╨╛╨║╨░╨╖╤ï╨▓╨░╤Ä╤ë╨╕╨╣, ╤ç╤é╨╛ ╨┐╤Ç╨╕ ╨╛╨▒╤Ç╨░╨▒╨╛╤é╨║╨╡ ╨┤╨░╨╜╨╜╤ï╤à ╤ä╨░╨╣╨╗╨░ ╨╜╨╡╤é ╨╛╤ê╨╕╨▒╨╛╨║
  148.     Dim intDate As Integer            '╨ö╨░╤é╨░, ╨║ ╨║╨╛╤é╨╛╤Ç╨╛╨╣ ╨╛╤é╨╜╨╛╤ü╨╕╤é╤ü╤Å ╨░╨╜╨░╨╗╨╕╨╖╨╕╤Ç╤â╨╡╨╝╨╛╨╡ ╨╖╨╜╨░╤ç╨╡╨╜╨╕╨╡ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░
  149.     Dim i As Integer
  150.         
  151.     fNoError = True
  152.     
  153.     For i=0 To 30
  154.         adValues(i)=0
  155.     Next
  156.     intMaxX = 0
  157.     
  158.     '╨₧╤é╨║╤Ç╤ï╤é╨╕╨╡ ╤é╨╡╨║╤ü╤é╨╛╨▓╨╛╨│╨╛ ╤ä╨░╨╣╨╗╨░ ╨┤╨╗╤Å ╤ç╤é╨╡╨╜╨╕╤Å ╨┤╨░╨╜╨╜╤ï╤à
  159.     intFileNumber = FreeFile()
  160.     Open strFileName For Input As #intFileNumber
  161.         
  162.     '╨ù╨░╤ç╨╕╤é╤ï╨▓╨░╨╡╨╝ ╨┐╨╛ ╨╛╨┤╨╜╨╛╨╣ ╤ü╤é╤Ç╨╛╨║╨╡ ╨╕╨╖ ╨┤╨╛ ╤é╨╡╤à ╨┐╨╛╤Ç, ╨┐╨╛╨║╨░ ╨╜╨╡ ╨┤╨╛╤ü╤é╨╕╨│╨╜╨╡╨╝ ╨║╨╛╨╜╤å╨░ ╤é╨╡╨║╤ü╤é╨╛╨▓╨╛╨│╨╛ ╤ä╨░╨╣╨╗╨░ ╨╕╨╗╨╕ ╨┐╨╛╨║╨░ ╨╜╨╡ ╨▓╨╛╨╖╨╜╨╕╨║╨╜╨╡╤é ╨╛╤ê╨╕╨▒╨║╨░    
  163.     Do While (Not EOF(intFileNumber)) And fNoError
  164.         '╨ù╨░╤ç╨╕╤é╨░╤é╤î ╤ü╤é╤Ç╨╛╨║╤â
  165.         Line Input #intFileNumber, strLineData
  166.         strLineData = Trim$(strLineData)
  167.         '╨ò╤ü╨╗╨╕ ╤ü╤é╤Ç╨╛╨║╨░ ╨╜╨╡ ╨┐╤â╤ü╤é╨░, ╨╛╨▒╤Ç╨░╨▒╨╛╤é╨░╨╡╨╝ ╨╡╨╡.
  168.         If strLineData <> "" Then
  169.             '╨¥╨░╨╣╤é╨╕ ╨┐╨╛╨╗╨╛╨╢╨╡╨╜╨╕╨╡ ╤ü╨╕╨╝╨▓╨╛╨╗╨░ "/", ╨╛╨│╤Ç╨░╨╜╨╕╤ç╨╕╨▓╨░╤Ä╤ë╨╡╨│╨╛ ╨┤╨░╤é╤â ╨▓ ╤ü╤é╤Ç╨╛╨║╨╡
  170.             intSeparatorPos = InStr(strLineData, "/")
  171.             If intSeparatorPos > 0 Then
  172.                 intDate = CInt(Left(strLineData, intSeparatorPos-1))
  173.                 If intDate > intMaxX Then
  174.                     intMaxX = intDate
  175.                 End If
  176.                 '╨¥╨░╨╣╤é╨╕ ╨┐╨╛╨╗╨╛╨╢╨╡╨╜╨╕╨╡ ╨┐╤Ç╨╛╨▒╨╡╨╗╨░, ╨╛╨│╤Ç╨░╨╜╨╕╤ç╨╕╨▓╨░╤Ä╤ë╨╡╨│╨╛ ╨┐╨╛╨║╨░╨╖╨░╤é╨╡╨╗╤î ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╨▓ ╤ü╤é╤Ç╨╛╨║╨╡
  177.                 intSeparatorPos = InStr(strLineData, " ")
  178.                 If intSeparatorPos > 0 Then
  179.                     '╨ö╨╛╨▒╨░╨▓╨╕╤é╤î ╨┐╨╛╨║╨░╨╖╨░╨╜╨╕╨╡ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╨▓ ╤ü╨╛╨╛╤é╨▓╨╡╤é╤ü╤é╨▓╤â╤Ä╤ë╨╕╨╣ ╨┤╨░╤é╨╡ ╤ì╨╗╨╡╨╝╨╡╨╜╤é ╨╝╨░╤ü╤ü╨╕╨▓╨░
  180.                     adValues(intDate-1)=adValues(intDate-1)+CDbl(Right(strLineData, Len(strLineData) - intSeparatorPos))
  181.                 End If
  182.             End If
  183.         End If
  184.     Loop
  185.     dblMaxDayTraffic = 0
  186.     dblMonthTraffic = 0
  187.     For i=0 To intMaxX -1
  188.         '╨ƒ╨╡╤Ç╨╡╨▓╨╡╤ü╤é╨╕ ╨╖╨╜╨░╤ç╨╡╨╜╨╕╨╡ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╨╕╨╖ ╨▒╨░╨╣╤é ╨▓ ╨╝╨╡╨│╨░╨▒╨░╨╣╤é╤ï
  189.         adValues(i)=adValues(i)/1024^2
  190.         '╨¥╨░╨╣╤é╨╕ ╨╜╨░╨╣╨▒╨╛╨╗╤î╤ê╨╡╨╡ ╨╖╨╜╨░╤ç╨╡╨╜╨╕╨╡ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╨▓ ╨┤╨╡╨╜╤î ╨▓ ╤ì╤é╨╛╨╝ ╨╝╨╡╤ü╤Å╤å╨╡.
  191.         If dblMaxDayTraffic < adValues(i) Then
  192.             dblMaxDayTraffic = adValues(i)
  193.         End If
  194.         '╨¥╨░╨╣╤é╨╕ ╤ü╤â╨╝╨╝╨░╤Ç╨╜╨╛╨╡ ╨╖╨╜╨░╤ç╨╡╨╜╨╕╨╡ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╨╖╨░ ╨╝╨╡╤ü╤Å╤å
  195.         dblMonthTraffic = dblMonthTraffic + adValues(i)
  196.     Next
  197.     
  198.     Close #intFileNumber
  199.     
  200.     LoadData = fNoError
  201.     Exit Function
  202.     
  203. ErrHandle:
  204.     MsgBox ("Proizoshla oshibka pri zachitivanii textovogo faila.", cdbExclamation)
  205.     LoadData = False
  206.     Exit Function
  207. End Function 
  208.  
  209. '========================================================================================================================
  210. '========================================================================================================================
  211.  
  212. '╨ƒ╨╛╤ü╤é╤Ç╨╛╨╡╨╜╨╕╨╡ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï ╨▓ ╨┤╨╛╨║╤â╨╝╨╡╨╜╤é╨╡ ConceptDraw
  213. Function DrawDiagram(ByVal strTextFileName As String) As Boolean
  214. On Error GoTo ErrHandle
  215.     Dim i As Long
  216.     Dim dblDiagHeight As Double        '╨Æ╤ï╤ü╨╛╤é╨░ ╨│╤Ç╤â╨┐╨┐╤ï, ╤ü╨╛╨┤╨╡╤Ç╨╢╨░╤ë╨╡╨╣ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤â
  217.     Dim curPage As Page            '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ ╤Ç╨░╨▒╨╛╤ç╤â╤Ä ╤ü╤é╤Ç╨░╨╜╨╕╤å╤â
  218.     Dim FileNameProp As CustomProp    '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ Custom Property ╨╛╨▒╤è╨╡╨║╤é╨░ (╨▓ ╨╛╨┤╨╜╨╛╨╝ ╨╕╨╖ ╨╜╨╕╤à ╤à╤Ç╨░╨╜╨╕╤é╤ü╤Å ╨┐╨╛╨╗╨╜╨╛╨╡ ╨╕╨╝╤Å ╤ä╨░╨╣╨╗╨░ ╨┤╨░╨╜╨╜╤ï╤à). 
  219.     Dim DiagramDayShape As Shape        '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ ╤ê╤ì╨╣╨┐ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï, ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨░╤Ä╤ë╨╡╨╣ ╤é╤Ç╨░╤ä╤ä╨╕╨║ ╨╖╨░ ╨║╨░╨╢╨┤╤ï╨╣ ╨┤╨╡╨╜╤î ╨╝╨╡╤ü╤Å╤å╨░
  220.     Dim DiagramSumShape As Shape        '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ ╤ê╤ì╨╣╨┐ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï, ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨░╤Ä╤ë╨╡╨╣ ╤ü╤â╨╝╨╝╨░╤Ç╨╜╤ï╨╣ ╤é╤Ç╨░╤ä╤ä╨╕╨║ ╨╖╨░ ╨╝╨╡╤ü╤Å╤å
  221.     Dim LineShape As Shape            '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ ╤ê╤ì╨╣╨┐, ╨┐╤Ç╨╡╨┤╤ü╤é╨░╨▓╨╗╤Å╤Ä╤ë╨╕╨╣ ╨╗╨╕╨╜╨╕╤Ä ╨│╤Ç╨░╤ä╨╕╨║╨░        
  222.     Dim TextBox As Shape            '╨í╤ü╤ï╨╗╨║╨░ ╨╜╨░ ╤ê╤ì╨╣╨┐, ╨┐╤Ç╨╡╨┤╤ü╤é╨░╨▓╨╗╤Å╤Ä╤ë╨╕╨╣ ╤é╨╡╨║╤ü╤é╨╛╨▓╤â╤Ä ╨┐╨╛╨┤╨┐╨╕╤ü╤î
  223.     Dim strLostShapesName As String    '╨í╤é╤Ç╨╛╨║╨░, ╤ü╨╛╨┤╨╡╤Ç╨╢╨░╤ë╨╡╨╡ ╨╕╨╝╤Å ╤â╨┤╨░╨╗╨╡╨╜╨╜╨╛╨│╨╛ ╤ê╤ì╨╣╨┐╨░, ╨╜╨╡╨╛╨▒╤à╨╛╨┤╨╕╨╝╨╛╨│╨╛ ╨┤╨╗╤Å ╨║╨╛╤Ç╤Ç╨╡╨║╤é╨╜╨╛╨╣ ╤Ç╨░╨▒╨╛╤é╤ï ╨╝╨░╨║╤Ç╨╛╤ü╨░    
  224.     Dim dblSumTraffic As Double        '╨í╤â╨╝╨╝╨░╤Ç╨╜╤ï╨╣ ╤é╤Ç╨░╤ä╤ä╨╕╨║ ╤ü ╨╜╨░╤ç╨░╨╗╨░ ╨╝╨╡╤ü╤Å╤å╨░
  225.     Dim dblMaxY As Double            '╨Ü╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨┤╨╡╨╗╨╡╨╜╨╕╨╣ ╤ê╨║╨░╨╗╤ï, ╨║╨╛╤é╨╛╤Ç╨╛╨╡ ╨▒╤â╨┤╨╡╤é ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨╡╨╜╨╛ ╨┐╨╛ ╨╛╤ü╨╕ OY
  226.     Dim intStep As Integer            '╨Ü╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╡╨┤╨╕╨╜╨╕╤å, ╨║╨╛╤é╨╛╤Ç╨╛╨╝╤â ╤ü╨╛╨╛╤é╨▓╨╡╤é╤ü╤é╨▓╤â╨╡╤é ╨╛╨┤╨╜╨╛ ╨┤╨╡╨╗╨╡╨╜╨╕╨╡ ╤ê╨║╨░╨╗╤ï
  227.     Dim dblStepScale As Double        '╨Ü╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╝╨╡╨│╨░╨▒╨░╨╣╤é, ╨║╨╛╤é╨╛╤Ç╨╛╨╡ ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨░╨╡╤é ╨╛╨┤╨╜╨░ ╨╡╨┤╨╕╨╜╨╕╤å╨░ ╤ê╨║╨░╨╗╤ï
  228.     Dim dblScale As Double            '╨£╨░╤ü╤ê╤é╨░╨▒ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï ╨┐╨╛ ╨╛╤ü╨╕ OY. ╨Ü╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╤Ä╨╜╨╕╤é╨╛╨▓ ╨▓ ╨╡╨┤╨╕╨╜╨╕╤å╨╡ ╤ê╨║╨░╨╗╤ï. 
  229.     Dim intScaleStepCount As Integer    '╨Æ╤ü╨┐╨╛╨╝╨╛╨│╨░╤é╨╡╨╗╤î╨╜╨░╤Å ╨┐╨╡╤Ç╨╡╨╝╨╡╨╜╨╜╨░╤Å, ╨╝╨╕╨╜╨╕╨╝╨░╨╗╤î╨╜╨╛╨╡ ╨║╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╡╨┤╨╕╨╜╨╕╤å, ╨║╨╛╤é╨╛╤Ç╨╛╨╡ ╨┐╨╛╨║╤Ç╤ï╨▓╨░╨╡╤é ╨▓╨╡╨╗╨╕╤ç╨╕╨╜╤â ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░
  230.     
  231.     Set curPage = thisDoc.Page(1)
  232.  
  233.     i=1
  234.     Set DiagramDayShape = Nothing
  235.     Set LegendShape = Nothing
  236.     '╨ÿ╤ë╨╡╨╝ ╨▓ ╨┤╨╛╨║╤â╨╝╨╡╨╜╤é╨╡ ╨╜╨╡╨╛╨▒╤à╨╛╨┤╨╕╨╝╤ï╨╡ ╤ê╤ì╨╣╨┐╤ï, ╨▓ ╨║╨╛╤é╨╛╤Ç╤ï╤à ╨┤╨╛╨╗╨╢╨╜╤ï ╨▒╤ï╤é╤î ╤ü╨╛╨╖╨┤╨░╨╜╤ï ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï ╨╜╨░ ╨║╨░╨╢╨┤╤ï╨╣ ╨┤╨╡╨╜╤î ╨╕ ╨╜╨░ ╨▓╨╡╤ü╤î ╨╝╨╡╤ü╤Å╤å.
  237.     Do While i <= curPage.ShapesNum()
  238.         if curPage.Shape(i).Name = "DiagramDay" Then
  239.             Set DiagramDayShape = curPage.Shape(i)
  240.         End If
  241.         if curPage.Shape(i).Name = "DiagramSum" Then
  242.             Set DiagramSumShape = curPage.Shape(i)
  243.         End If
  244.         i=i+1
  245.     Loop    
  246.     strLostShapesName = ""
  247.     If DiagramDayShape = Nothing Then
  248.         strLostShapesName = "DiagramDay"
  249.     End If
  250.     If DiagramSumShape = Nothing Then
  251.         strLostShapesName = "DiagramSum"
  252.     End If
  253.     '╨ò╤ü╨╗╨╕ ╤ê╤ì╨╣╨┐ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï ╨╜╨╡ ╨╜╨░╨╣╨┤╨╡╨╜, ╨▓╤ï╨┤╨░╨╡╤é╤ü╤Å ╤ü╨╛╨╛╨▒╤ë╨╡╨╜╨╕╨╡ ╨╛╨▒ ╨╛╤ê╨╕╨▒╨║╨╡ ╨╕ ╨▓╤ï╨┐╨╛╨╗╨╜╨╡╨╜╨╕╨╡ ╨╝╨░╨║╤Ç╨╛╤ü╨░ ╨┐╤Ç╨╡╨║╤Ç╨░╤ë╨░╨╡╤é╤ü╤Å. 
  254.     If strLostShapesName <> "" Then
  255.         MsgBox("Voznikla oshibka. Neobhodimij dlja postroenija diagrammi ob'ekt s name """ & strLostShapesName & """ v dokumente ne najden.")
  256.         DrawDiagram = False
  257.         Exit Function
  258.     End If
  259.     
  260.     '╨ô╤Ç╤â╨┐╨┐╨░, ╨▓ ╨║╨╛╤é╨╛╤Ç╤ï╤à ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨░╤Ä╤é╤ü╤Å ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╤ï, ╨╛╤ç╨╕╤ë╨░╤Ä╤é╤ü╤Å ╨╛╤é child-╤ê╤ì╨╣╨┐╨╛╨▓. ╨₧╤ü╤é╨░╤Ä╤é╤ü╤Å ╤é╨╛╨╗╤î╨║╨╛ ╨╛╤ü╨╕ ╨╕ ╨╕╤à ╨┐╨╛╨┤╨┐╨╕╤ü╨╕.
  261.     '╨ƒ╨╛╤ü╨║╨╛╨╗╤î╨║╤â ╨┐╨╛╤ü╨╗╨╡ ╤â╨┤╨░╨╗╨╡╨╜╨╕╤Å ╨╛╨┤╨╜╨╛╨│╨╛ ╤ê╤ì╨╣╨┐╨░ ╨╕╨╜╨┤╨╡╨║╤ü╤ï ╨╛╤ü╤é╨░╨╗╤î╨╜╤ï╤à ╨░╨▓╤é╨╛╨╝╨░╤é╨╕╤ç╨╡╤ü╨║╨╕ ╨┐╨╡╤Ç╨╡╤ü╤ç╨╕╤é╤ï╨▓╨░╤Ä╤é╤ü╤Å,
  262.     '╤ç╤é╨╛╨▒╤ï ╨╖╨░╨┐╨╛╨╗╨╜╨╕╤é╤î ╨▓╤ï╨┐╨░╨▓╤ê╨╕╨╣ ╨╕╨╜╨┤╨╡╨║╤ü, ╨┐╨╡╤Ç╨╡╨▒╨╛╤Ç ╤ì╨╗╨╡╨╝╨╡╨╜╤é╨╛╨▓ ╨╜╨░╤ç╨╕╨╜╨░╨╡╤é╤ü╤Å ╤ü ╨╜╨░╨╕╨▒╨╛╨╗╤î╤ê╨╡╨│╨╛ ╨╕╨╜╨┤╨╡╨║╤ü╨░.
  263.     For i=DiagramDayShape.ShapesNum() To 1 Step -1
  264.         If DiagramDayShape.Shape(i).Name <> "DescX" And DiagramDayShape.Shape(i).Name <> "DescY" And DiagramDayShape.Shape(i).Name <> "OX" And DiagramDayShape.Shape(i).Name <> "OY" Then
  265.             DiagramDayShape.RemoveShape(i)
  266.         End If
  267.     Next
  268.     For i=DiagramSumShape.ShapesNum() To 1 Step -1
  269.         If DiagramSumShape.Shape(i).Name <> "DescX" And DiagramSumShape.Shape(i).Name <> "DescY" And DiagramSumShape.Shape(i).Name <> "OX" And DiagramSumShape.Shape(i).Name <> "OY" Then
  270.             DiagramSumShape.RemoveShape(i)
  271.         End If
  272.     Next
  273.     
  274.     '╨ô╤Ç╨░╤ä╨╕╨║ ╨╜╨░ ╨║╨░╨╢╨┤╤ï╨╣ ╨┤╨╡╨╜╤î ╨╝╨╡╤ü╤Å╤å╨░. 
  275.     '╨Æ╤ï╤ç╨╕╤ü╨╗╤Å╨╡╨╝ ╨┐╨░╤Ç╨░╨╝╨╡╤é╤Ç╤ï ╨╛╤ü╨╕ OY - ╨╝╨░╤ü╤ê╤é╨░╨▒, ╨║╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╜╨░╨╜╨╛╤ü╨╕╨╝╤ï╤à ╨┤╨╡╨╗╨╡╨╜╨╕╨╣, ╨║╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╡╨┤╨╕╨╜╨╕╤å, 
  276.     '╨║╨╛╤é╨╛╤Ç╤ï╨╡ ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨░╨╡╤é ╨║╨░╨╢╨┤╨╛╨╡ ╨┤╨╡╨╗╨╡╨╜╨╕╨╡.
  277.     dblStepScale = CalcScaleStep(dblMaxDayTraffic)
  278.     intScaleStepCount = dblMaxDayTraffic \ dblStepScale + 1
  279.     Select Case intScaleStepCount 
  280.     Case 1 To 25
  281.         dblMaxY = 25
  282.         intStep = 1
  283.         dblScale = 100
  284.     Case 26 To 50
  285.         dblMaxY = 50
  286.         intStep = 1
  287.         dblScale = 50
  288.     Case 51 To 75
  289.         dblMaxY = 75
  290.         intStep = 3
  291.         dblScale = 33.33333
  292.     Case Else
  293.         dblMaxY = 100
  294.         intStep = 2
  295.         dblScale = 25
  296.     End Select
  297.     
  298.     '╨á╨╕╤ü╤â╨╡╨╝ ╨│╤Ç╨░╤ä╨╕╨║ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╨╖╨░ ╨║╨░╨╢╨┤╤ï╨╣ ╨┤╨╡╨╜╤î ╨╝╨╡╤ü╤Å╤å╨░
  299.     dblDiagHeight = DiagramDayShape.Height
  300.     Set LineShape = DiagramDayShape.BeginShape()
  301.     LineShape.PenColor.Index = 12
  302.     LineShape.PenWeight = 6
  303.     DiagramDayShape.MoveTo(0, dblDiagHeight)
  304.     DiagramDayShape.LineTo(0, dblDiagHeight - adValues(0)*dblScale)
  305.     For i=1 To intMaxX - 1
  306.         DiagramDayShape.LineTo(i*condblXScale, dblDiagHeight - adValues(i)*dblScale/dblStepScale)
  307.     Next
  308.     DiagramDayShape.LineTo((intMaxX-1)*condblXScale, dblDiagHeight)
  309.     DiagramDayShape.LineTo(0, dblDiagHeight)
  310.     LineShape.FillPattern = 1
  311.     LineShape.FillColor.Index = 12
  312.     DiagramDayShape.EndShape()
  313.     '╨¥╨░╨╜╨╛╤ü╨╕╨╝ ╤ê╨║╨░╨╗╤â ╨╜╨░ ╨╛╤ü╤î OY
  314.     For i=intStep To dblMaxY Step intStep 
  315.         '╨¿╤é╤Ç╨╕╤à ╨╛╤ü╨╕ OY
  316.         DiagramDayShape.DrawLine(-10, dblDiagHeight - i*dblScale, 10, dblDiagHeight - i*dblScale)
  317.         '╨ƒ╨╛╨┤╨┐╨╕╤ü╤î ╨▓╨╛╨╖╨╗╨╡ ╤ê╤é╤Ç╨╕╤à╨░
  318.         DrawTextBox(DiagramDayShape, -150, dblDiagHeight - i*dblScale - 25, -20, dblDiagHeight - i*dblScale + 25, CStr(dblStepScale * i), 10, 0, 2)
  319.     Next
  320.     '╨¥╨░╨╜╨╛╤ü╨╕╨╝ ╤ê╨║╨░╨╗╤â ╨╜╨░ ╨╛╤ü╤î OX
  321.     For i=2 To intMaxX 
  322.         DiagramDayShape.DrawLine((i-1)*condblXScale, dblDiagHeight + 10, (i-1)*condblXScale, dblDiagHeight - 10)
  323.         DrawTextBox(DiagramDayShape, (i-1)*condblXScale-25, dblDiagHeight + 20, (i-1)*condblXScale+25, dblDiagHeight+70, CStr(i), 10, 0, 1)
  324.     Next
  325.     
  326.     
  327.     '╨ô╤Ç╨░╤ä╨╕╨║ ╤ü╤â╨╝╨╝╨░╤Ç╨╜╨╛╨│╨╛ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╤ü ╨╜╨░╤ç╨░╨╗╨░ ╨╝╨╡╤ü╤Å╤å╨░. 
  328.     '╨Æ╤ï╤ç╨╕╤ü╨╗╤Å╨╡╨╝ ╨┐╨░╤Ç╨░╨╝╨╡╤é╤Ç╤ï ╨╛╤ü╨╕ OY - ╨╝╨░╤ü╤ê╤é╨░╨▒, ╨║╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╜╨░╨╜╨╛╤ü╨╕╨╝╤ï╤à ╨┤╨╡╨╗╨╡╨╜╨╕╨╣, ╨║╨╛╨╗╨╕╤ç╨╡╤ü╤é╨▓╨╛ ╨╡╨┤╨╕╨╜╨╕╤å, 
  329.     '╨║╨╛╤é╨╛╤Ç╤ï╨╡ ╨╕╨╖╨╛╨▒╤Ç╨░╨╢╨░╨╡╤é ╨║╨░╨╢╨┤╨╛╨╡ ╨┤╨╡╨╗╨╡╨╜╨╕╨╡.
  330.     dblStepScale = CalcScaleStep(dblMonthTraffic)
  331.     intScaleStepCount = dblMaxDayTraffic \ dblStepScale + 1
  332.     Select Case intScaleStepCount 
  333.     Case 1 To 25
  334.         dblMaxY = 25
  335.         intStep = 1
  336.         dblScale = 100
  337.     Case 26 To 50
  338.         dblMaxY = 50
  339.         intStep = 1
  340.         dblScale = 50
  341.     Case 51 To 75
  342.         dblMaxY = 75
  343.         intStep = 3
  344.         dblScale = 100
  345.     Case Else
  346.         dblMaxY = 100
  347.         intStep = 2
  348.         dblScale = 50
  349.     End Select
  350.     dblDiagHeight = DiagramSumShape.Height
  351.     dblSumTraffic = 0
  352.     '╨á╨╕╤ü╤â╨╡╨╝ ╨│╤Ç╨░╤ä╨╕╨║ ╤ü╤â╨╝╨╝╨░╤Ç╨╜╨╛╨│╨╛ ╤é╤Ç╨░╤ä╤ä╨╕╨║╨░ ╤ü ╨╜╨░╤ç╨░╨╗╨░ ╨╝╨╡╤ü╤Å╤å╨░
  353.     Set LineShape = DiagramSumShape.BeginShape()
  354.     LineShape.PenColor.Index = 12 
  355.     LineShape.PenWeight = 6
  356.     DiagramSumShape.MoveTo(0, dblDiagHeight)
  357.     For i=0 To intMaxX - 1
  358.         dblSumTraffic = dblSumTraffic + adValues(i)
  359.         DiagramSumShape.LineTo((i+1)*condblXScale, dblDiagHeight - dblSumTraffic*dblScale/dblStepScale)
  360.     Next
  361.     DiagramSumShape.LineTo(intMaxX*condblXScale, dblDiagHeight)
  362.     DiagramSumShape.LineTo(0, dblDiagHeight)
  363.     LineShape.FillPattern = 1
  364.     LineShape.FillColor.Index = 12
  365.     DiagramSumShape.EndShape()
  366.     '╨¥╨░╨╜╨╛╤ü╨╕╨╝ ╤ê╨║╨░╨╗╤â ╨╜╨░ ╨╛╤ü╤î OY
  367.     For i=intStep To dblMaxY Step intStep 
  368.         DiagramSumShape.DrawLine(-10, dblDiagHeight - i*dblScale, 10, dblDiagHeight - i*dblScale)
  369.         DrawTextBox(DiagramSumShape, -150, dblDiagHeight - i*dblScale - 25, -20, dblDiagHeight - i*dblScale + 25, CStr(dblStepScale * i), 10, 0, 2)
  370.     Next
  371.     '╨¥╨░╨╜╨╛╤ü╨╕╨╝ ╤ê╨║╨░╨╗╤â ╨╜╨░ ╨╛╤ü╤î OX
  372.     For i=1 To intMaxX 
  373.         DiagramSumShape.DrawLine(i*condblXScale, dblDiagHeight + 10, i*condblXScale, dblDiagHeight - 10)
  374.         DrawTextBox(DiagramSumShape, i*condblXScale-25, dblDiagHeight + 20, i*condblXScale+25, dblDiagHeight+70, CStr(i), 10, 0, 1)
  375.     Next    
  376.     
  377.     
  378.  
  379.     i=1
  380.     Set FileNameProp = Nothing
  381.     '╨ƒ╤Ç╨╛╨▓╨╡╤Ç╤Å╨╡╨╝, ╨╡╤ü╤é╤î ╨╗╨╕ ╨▓ ╨┤╨╕╨░╨│╤Ç╨░╨╝╨╝╨╡ CustomProperty ╤ü ╨╕╨╝╨╡╨╜╨╡╨╝ ╤ä╨░╨╣╨╗╨░-╨╕╤ü╤é╨╛╤ç╨╜╨╕╨║╨░ ╨┤╨░╨╜╨╜╤ï╤à.
  382.     '╨ò╤ü╨╗╨╕ ╨╡╤ü╤é╤î, ╨┐╨╛╨╝╨╡╤ë╨░╨╡╨╝ ╨▓ ╨╜╨╡╨│╨╛ ╨╕╨╝╤Å ╨┐╨╛╤ü╨╗╨╡╨┤╨╜╨╡╨│╨╛ ╨╕╤ü╨┐╨╛╨╗╤î╨╖╨╛╨▓╨░╨▓╤ê╨╡╨│╨╛╤ü╤Å ╤ä╨░╨╣╨╗╨░.
  383.     Do While i<=DiagramDayShape.CustomPropsNum() And FileNameProp = Nothing
  384.         If DiagramDayShape.CustomProp(i).Label = "LastSourceFileName" Then
  385.             Set FileNameProp = DiagramDayShape.CustomProp(i) 
  386.         End If
  387.         i = i + 1    
  388.     Loop 
  389.     '╨ò╤ü╨╗╨╕ ╤é╨░╨║╨╛╨│╨╛ CustomProperty ╨╜╨╡ ╨╜╨░╨╣╨┤╨╡╨╜╨╛, ╤ü╨╛╨╖╨┤╨░╨╡╨╝ ╨╡╨│╨╛ ╤ü╨░╨╝╨╕.
  390.     If FileNameProp = Nothing Then
  391.         Set FileNameProp = DiagramDayShape.AddCustomProp() 
  392.         FileNameProp.Label = "LastSourceFileName" 
  393.     End If
  394.     FileNameProp.Value = strTextFileName 
  395.     FileNameProp.Type = 0
  396.     FileNameProp.Prompt = "Imja Fajla, ispol'zovavshegosja v kachestve poslednego istochnika dannih"
  397.     
  398.     DrawDiagram = True
  399.     Exit Function
  400. ErrHandle:
  401.     MsgBox ("Proizoshla oshibka pri postroenii diagrammi.", cdbExclamation)
  402.     DrawDiagram = False
  403.     Exit Function
  404. End Function
  405.  
  406. '========================================================================================================================
  407. '========================================================================================================================
  408.  
  409. '╨í╨╛╨╖╨┤╨░╨╜╨╕╨╡ ╤ê╤ì╨╣╨┐╨░ TextBox ╤ü ╨╜╨╡╨║╨╛╤é╨╛╤Ç╤ï╨╝ ╤é╨╡╨║╤ü╤é╨╛╨╝.
  410. 'GroupShape - ╤ü╤ü╤ï╨╗╨║╨░ ╨╜╨░ ╤ê╤ì╨╣╨┐-╨│╤Ç╤â╨┐╨┐╤â, ╨▓╨╜╤â╤é╤Ç╨╕ ╨║╨╛╤é╨╛╤Ç╨╛╨╣ ╨┤╨╛╨╗╨╢╨╜╨░ ╨▒╤ï╤é╤î ╨┐╨╛╨╝╨╡╤ë╨╡╨╜╨░ ╨╜╨░╨┤╨┐╨╕╤ü╤î
  411. 'x1, y1 - ╨║╨╛╨╛╤Ç╨┤╨╕╨╜╨░╤é╤ï ╨▓╨╡╤Ç╤à╨╜╨╡╨│╨╛ ╨╗╨╡╨▓╨╛╨│╨╛ ╤â╨│╨╗╨░ ╨┐╤Ç╤Å╨╝╨╛╤â╨│╨╛╨╗╤î╨╜╨╕╨║╨░ ╤ü ╤é╨╡╨║╤ü╤é╨╛╨╝ ╨▓ ╤ü╨╕╤ü╤é╨╡╨╝╨╡ ╨║╨╛╨╛╤Ç╨┤╨╕╨╜╨░╤é ╤Ç╨╛╨┤╨╕╤é╨╡╨╗╤î╤ü╨║╨╛╨│╨╛ ╤ê╤ì╨╣╨┐╨░
  412. 'x2, y2 - ╨║╨╛╨╛╤Ç╨┤╨╕╨╜╨░╤é╤ï ╨┐╤Ç╨░╨▓╨╛╨│╨╛ ╨╜╨╕╨╢╨╜╨╡╨│╨╛ ╤â╨│╨╗╨░ ╨┐╤Ç╤Å╨╝╨╛╤â╨│╨╛╨╗╤î╨╜╨╕╨║╨░ ╤ü ╤é╨╡╨║╤ü╤é╨╛╨╝ ╨▓ ╤ü╨╕╤ü╤é╨╡╨╝╨╡ ╨║╨╛╨╛╤Ç╨┤╨╕╨╜╨░╤é ╤Ç╨╛╨┤╨╕╤é╨╡╨╗╤î╤ü╨║╨╛╨│╨╛ ╤ê╤ì╨╣╨┐╨░
  413. 'strText - ╤é╨╡╨║╤ü╤é ╨╜╨░╨┤╨┐╨╕╤ü╨╕
  414. 'lTextSize - ╤Ç╨░╨╖╨╝╨╡╤Ç ╤ê╤Ç╨╕╤ä╤é╨░
  415. 'lTextStyle - ╤ü╤é╨╕╨╗╤î ╤ê╤Ç╨╕╤ä╤é╨░
  416. 'intHAlign - ╨│╨╛╤Ç╨╕╨╖╨╛╨╜╤é╨░╨╗╤î╨╜╨╛╨╡ ╨▓╤ï╤Ç╨░╨▓╨╜╨╕╨▓╨░╨╜╨╕╨╡ ╤é╨╡╨║╤ü╤é╨░
  417. Function DrawTextBox(ByVal GroupShape As Shape, ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal strText As String, ByVal lTextSize As Long, ByVal lTextStyle As Long, ByVal intHAlign As Byte) As Shape
  418.     Set DrawTextBox= GroupShape.DrawRect(x1, y1, x2, y2)
  419.     DrawTextBox.FillPattern = 0
  420.     DrawTextBox.PenPattern = 0
  421.     DrawTextBox.Text = strText 
  422.     DrawTextBox.SetCharSize(1, Len(strText), lTextSize)
  423.     DrawTextBox.SetCharStyle(1, Len(strText), lTextStyle)
  424.     DrawTextBox.SetCharColor(1, Len(strText), 0, 0, 0)
  425.     DrawTextBox.SetParaHAlign(1, Len(strText), intHAlign)
  426. End Function 
  427.  
  428. '========================================================================================================================
  429. '========================================================================================================================
  430.  
  431. 'Adjusting the suitable scale for the diagram
  432. Function CalcScaleStep(ByRef dblMax As Double) As Double
  433.     CalcScaleStep = 1
  434.     If dblMax > 0 Then 'Checking the correctness of the parameter
  435.         CalcScaleStep = 10 ^ Int(Log(dblMax) / Log(10))
  436.         If CalcScaleStep = dblMax Then
  437.             CalcScaleStep = CalcScaleStep / 10
  438.         End If
  439.     End If
  440.     CalcScaleStep = CalcScaleStep / 10
  441. End Function
  442.  
  443.  
  444.