proc setCharts {} {
global cht
global attName
global aValue
global atts
global target
global CumVol
global CumTon
global targetVol
global targetTon
global volCht
set rowCount [$atts getRowCount]
for { set i 0} {$i < $rowCount} {incr i} {
set aName [$attName getCurrentValue $i]
if { $aName != "" } {
set value [$aValue getCurrentValue $i]
set targetValue [$target getCurrentValue $i]
set aboveValue 0
set belowValue 0
if { [expr $value > $targetValue] } {
set aboveValue [expr $value - $targetValue]
set belowValue 0
set value $targetValue
} else {
set aboveValue 0
set belowValue [expr $targetValue - $value]
}
set rowIndex [expr $i+1]
set catName "[$attName getCurrentValue $i]"
$cht setCategoryValue "Value" $catName $value
$cht setCategoryValue "Above Target" $catName $aboveValue
$cht setCategoryValue "Below Target" $catName $belowValue
}
}
$cht drawChart
for { set i 0} {$i < 2} {incr i} {
set aboveValue 0
set belowValue 0
set value 0
set targetValue 0
set catName ""
if { $i == 0 } {
set value [$CumVol getCurrentValue]
set targetValue [$targetVol getCurrentValue]
set catName "Volume"
} else {
set value [$CumTon getCurrentValue]
set targetValue [$targetTon getCurrentValue]
set catName "Tonnes"
}
if { [expr $targetValue > 0.001] } {
if { [expr $value > $targetValue] } {
set aboveValue [expr $value - $targetValue]
set belowValue 0
set value $targetValue
} else {
set aboveValue 0
set belowValue [expr $targetValue - $value]
}
}
$volCht setCategoryValue "Value" $catName $value
$volCht setCategoryValue "Above Target" $catName $aboveValue
$volCht setCategoryValue "Below Target" $catName $belowValue
$volCht drawChart
}
$target setVisible false
}
GuidoForm frm20521 {
-label "Mining Block Results"
-layout BoxLayout Y_AXIS
-action initial {[setCharts]}
-add_button default_apply "Accept"
-add_button default_cancel "Reject"
-add_button "finished" "Finished" true "icons/RightArrow.gif"
-add_button default_help
GuidoPanel topPanel {
-layout BoxLayout X_AXIS
GuidoPanel frm20521_16 {
-layout BoxLayout Y_AXIS
GuidoFiller space {
-height 0.5
}
GuidoPanel selection {
-label "Selection"
-border etched true
-layout CentrelineLayout
GuidoField BlockVol {
-label "Volume"
-display_length 10
-decimals 1
-format none
-max_length 30
-translate none
}
GuidoField BlockTon {
-label "Tonnage"
-display_length 10
-decimals 1
-format none
-max_length 30
-translate none
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel cumulative {
-label "Cumulative"
-border etched true
-layout CentrelineLayout
GuidoField CumVol {
-label "Volume"
-display_length 10
-decimals 1
-format none
-max_length 30
-translate none
}
GuidoField CumTon {
-label "Tonnage"
-display_length 10
-decimals 1
-format none
-max_length 30
-translate none
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel target {
-label "LPS_TARGET"
-border etched true
-layout CentrelineLayout
GuidoField targetVol {
-label "Volume"
-display_length 10
-decimals 1
-format none
-max_length 30
-translate none
}
GuidoField targetTon {
-label "Tonnage"
-display_length 10
-decimals 1
-format none
-max_length 30
-translate none
}
}
}
GuidoFiller frm20521_17 {
-width 1
}
GuidoPanel outer {
-layout BoxLayout Y_AXIS
GuidoFiller space {
-height 0.5
}
GuidoPanel table {
-label "Attributes"
-border etched true
GuidoScrollPane frm20521_11 {
-height 10
GuidoTable atts {
-instances 1 1 50
-interactive false
GuidoField attName {
-display_length 10
-format none
-input false
-label "Value Name"
-max_length BM_MAX_ATT_NAME_LEN
-translate none
}
GuidoField aValue {
-display_length 1
-format none
-input false
-label "Total Value"
-max_length 30
-translate none
-decimals 4
}
GuidoField value {
-display_length 10
-format none
-input false
-label "Selection Value"
-max_length 30
-translate none
-decimals 4
}
GuidoField target {
-format none
-width 0
-max_length 30
-translate none
-input false
-decimals 4
}
}
}
}
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel bottomPanel {
-layout BoxLayout X_AXIS
GuidoChart volCht {
-width 15
-height 15
-legend true
-chartType "3D Stacked Bar"
-chartTitle "Cumulative Volume/Tonnage"
-xAxisLabel "Cumulative"
-yAxisLabel "Volume/Tonnage"
-simpleChartContextMenu true
}
GuidoFiller space {
-width 1
}
GuidoPanel chtPanel {
-layout BoxLayout Y_AXIS
GuidoChart cht {
-width 20
-height 15
-legend true
-chartType "3D Stacked Bar"
-chartTitle "Attribute Values"
-xAxisLabel "Attribute"
-yAxisLabel "Target Grade/Aggregate"
-simpleChartContextMenu true
}
}
}
}
