Search code examples
crystal-reports

Crystal Reports: highlight minimum and maximum value on a chart


I am working to highlight the max and min value on a chart. The highlight option from the chart expert isn't much of a help. enter image description here

Is there a way to do this on a chart?


Solution

  • Create 3 formulas. One to return only the max value, second to return min value and then another to return all data minus the max and min.

        //max_value
        If  ({DETAILS.Qty Budget} = maximum({DETAILS.Qty Budget}))         
        then {DETAILS.Qty Budget} else 0
    
    
        //min_value
        If  ({DETAILS.Qty Budget} =  minimum({DETAILS.Qty Budget}))     
        then {DETAILS.Qty Budget} else 0
    
        //all_data 
        If  ({DETAILS.Qty Budget} = maximum({DETAILS.Qty Budget})) 
        or ({DETAILS.Qty Budget} = minimum({DETAILS.Qty Budget}))
        then 0 else {DETAILS.Qty Budget}
    
    1. Go to Chart Expert and under "Report Fields" you should see the 3 formulas.

      Add them to "Shows value(s):" box

    2. Go to "Color Highlight" tab and select new. Insert your max and min formulas and specify condition for each ( since we are only selecting max and min with those just choose > 0 .

    I got the idea from SAP Support. This works for me on CR 23 for Visual Studio 2017.