update,
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
Attribute VB_Name = "CasePersistencyGraph"
|
||||
|
||||
Function TeamACaseDistributionTable(ByVal calc_result As Variant, ByVal FILE_PATH As String)
|
||||
Const HEADER_ROW As Long = 1
|
||||
Const START_CELL As String = "A1"
|
||||
Dim wb As Workbook
|
||||
Dim ws As Worksheet
|
||||
Dim startCell As Range
|
||||
|
||||
Dim case_team_a_meta As Variant
|
||||
Dim case_team_b_meta As Variant
|
||||
|
||||
case_team_a_meta = calc_result(5)
|
||||
case_team_b_meta = calc_result(6)
|
||||
|
||||
' Open the workbook
|
||||
Set wb = Workbooks.Open(FILE_PATH)
|
||||
Set ws = wb.Sheets("Case persistency")
|
||||
|
||||
' Write headers
|
||||
Set startCell = ws.Range(START_CELL)
|
||||
startCell.Value = "Team A Case Distribution"
|
||||
startCell.Offset(1, 0).Value = "State"
|
||||
startCell.Offset(1, 1).Value = "Case"
|
||||
|
||||
startCell.Offset(1+1, 0).Value = "Collapse"
|
||||
startCell.Offset(1+2, 0).Value = "New Case"
|
||||
|
||||
startCell.Offset(1+1, 1).Value = case_team_a_meta(0)
|
||||
startCell.Offset(1+2, 1).Value = case_team_a_meta(1)
|
||||
|
||||
' TODO: replace content to real data
|
||||
|
||||
' Save and close the workbook
|
||||
' wb.Close SaveChanges:=True
|
||||
End Function
|
||||
|
||||
Function TeamACaseDistributionGraph(ByVal calc_result As Variant, ByVal FILE_PATH As String)
|
||||
Dim wb As Workbook
|
||||
Dim ws As Worksheet
|
||||
|
||||
Set wb = Workbooks.Open(FILE_PATH)
|
||||
Set ws = wb.Sheets("Case persistency")
|
||||
|
||||
ActiveSheet.Shapes.AddChart2(251, xlPie).Select
|
||||
ActiveChart.SetSourceData Source:=Range("$A$2:$B$4")
|
||||
ActiveChart.SetElement (msoElementLegendNone)
|
||||
ActiveChart.SetElement (msoElementDataLabelCallout)
|
||||
ActiveChart.ChartTitle.Select
|
||||
ActiveChart.ChartTitle.Text = "Team A case Distribution"
|
||||
Selection.Format.TextFrame2.TextRange.Characters.Text = "Team A case Distribution"
|
||||
|
||||
Set cho = ws.ChartObjects(ws.ChartObjects.Count)
|
||||
Set cht = cho.Chart
|
||||
cho.Top = 0
|
||||
cho.Left = 0
|
||||
cho.Width = 400
|
||||
cho.Height = 300
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Function TeamBCaseDistributionTable(ByVal calc_result As Variant, ByVal FILE_PATH As String)
|
||||
Const HEADER_ROW As Long = 1
|
||||
Const START_CELL As String = "F1"
|
||||
Dim wb As Workbook
|
||||
Dim ws As Worksheet
|
||||
Dim startCell As Range
|
||||
|
||||
Dim case_team_a_meta As Variant
|
||||
Dim case_team_b_meta As Variant
|
||||
|
||||
case_team_a_meta = calc_result(5)
|
||||
case_team_b_meta = calc_result(6)
|
||||
|
||||
' Open the workbook
|
||||
Set wb = Workbooks.Open(FILE_PATH)
|
||||
Set ws = wb.Sheets("Case persistency")
|
||||
|
||||
' Write headers
|
||||
Set startCell = ws.Range(START_CELL)
|
||||
startCell.Value = "Team B Case Distribution"
|
||||
startCell.Offset(1, 0).Value = "State"
|
||||
startCell.Offset(1, 1).Value = "Case"
|
||||
|
||||
startCell.Offset(1+1, 0).Value = "Collapse"
|
||||
startCell.Offset(1+2, 0).Value = "New Case"
|
||||
|
||||
startCell.Offset(1+1, 1).Value = case_team_b_meta(0)
|
||||
startCell.Offset(1+2, 1).Value = case_team_b_meta(1)
|
||||
|
||||
End Function
|
||||
|
||||
Function TeamBCaseDistributionGraph(ByVal calc_result As Variant, ByVal FILE_PATH As String)
|
||||
Dim wb As Workbook
|
||||
Dim ws As Worksheet
|
||||
|
||||
Set wb = Workbooks.Open(FILE_PATH)
|
||||
Set ws = wb.Sheets("Case persistency")
|
||||
|
||||
ActiveSheet.Shapes.AddChart2(251, xlPie).Select
|
||||
ActiveChart.SetSourceData Source:=Range("F2:G4")
|
||||
ActiveChart.SetElement (msoElementLegendNone)
|
||||
ActiveChart.SetElement (msoElementDataLabelCallout)
|
||||
ActiveChart.ChartTitle.Select
|
||||
ActiveChart.ChartTitle.Text = "Team B case Distribution"
|
||||
Selection.Format.TextFrame2.TextRange.Characters.Text = "Team B case Distribution"
|
||||
|
||||
Set cho = ws.ChartObjects(ws.ChartObjects.Count)
|
||||
Set cht = cho.Chart
|
||||
cho.Top = 0
|
||||
cho.Left = 400
|
||||
cho.Width = 400
|
||||
cho.Height = 300
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Function Helloworld()
|
||||
Debug.Print "helloworld CasePersistency"
|
||||
End Function
|
||||
|
Reference in New Issue
Block a user