This repository was archived by the owner on Jan 14, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ function visualizeFrequency(data) {
5050 //set the frequency color scale
5151 const values = Object . values ( data ) ;
5252 const max = Math . max ( ...values ) ;
53+ const avg = max / 2 ;
5354 const myFrequencyScale = frequencyScale ( 0 , max )
5455
5556 //change activity style through mxGraph
@@ -67,9 +68,16 @@ function visualizeFrequency(data) {
6768 activityCell = mxGraph . getModel ( ) . getCell ( activityElement . bpmnSemantic . id )
6869 activityCurrentStyle = mxGraph . getModel ( ) . getStyle ( activityCell )
6970 mxGraph . getModel ( ) . beginUpdate ( )
70- try {
71- let style = mxgraph . mxUtils . setStyle ( activityCurrentStyle , " fillColor" , myFrequencyScale ( freqValue ) )
71+ try {
72+ let style = mxgraph . mxUtils . setStyle ( activityCurrentStyle , ' fillColor' , myFrequencyScale ( freqValue ) )
7273 mxGraph . getModel ( ) . setStyle ( activityCell , style ) ;
74+ activityCurrentStyle = mxGraph . getModel ( ) . getStyle ( activityCell )
75+
76+ //set label to white when the activity fillColor is above the scale average
77+ if ( freqValue > avg ) {
78+ style = mxgraph . mxUtils . setStyle ( activityCurrentStyle , 'fontColor' , 'white' )
79+ mxGraph . getModel ( ) . setStyle ( activityCell , style ) ;
80+ }
7381 } finally {
7482 mxGraph . getModel ( ) . endUpdate ( ) ;
7583 }
You can’t perform that action at this time.
0 commit comments