+ Start a Discussion
Alo SenAlo Sen 

How to say 'if the value is greater than 0' in apex repeat in a highchart series


series: [{ name: 'Facilities that Started in RRT',
data: [ <apex:repeat value="{!ACRecord}" var="sc">
{!sc.Facilities_Started_in_RRT__c},
</apex:repeat>] },

In the above code I want to say - show the data only when the value of the variable is greater than zero. Is there a way to do this? this code is a part of Highchart using the Series for data.
William TranWilliam Tran
It's best to filter the value in the controller and send back the filtered dataset.  

VF pages can have logic, but it's purpose is mainly to display data. 

So instead of using {!ACRecord}, it should be using the filtered one like: {!ACRecordFIltered}

Thx.
Pramodh KumarPramodh Kumar
You can use like this
<apex:repeat value="{!Details}" var ="det" rendered="{!Details.size>0}">
</apex:repeat>
Alo SenAlo Sen
Pramodh, the Details or the ACRecord is not the problem. It is the individual fields in the list ACRecord where the value has to be greater than zero.
William, the ACRecord is a list that holds over 100 fields. It is a query of all the fields in an object. Sets of fields are used in different vf dashboard pages. I was wondering how best to handle this in the controller. Some fields do need to have a default value of zero, while others should not show if the value is zero. Having separate queries for each vf page maybe?
Alo SenAlo Sen
I was able to solve this by adding the following code
{if(this.y != 0) {return ''+ this.y;}} on the plotoptions formatter function. 
  plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                       enabled: true,
                        color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white',
                           formatter: function() {if(this.y != 0) {return ''+ this.y;}}
                    }
                }
            },
There is an answer from the following site.
http://stackoverflow.com/questions/15834687/how-to-hide-zero-values-in-column-chart
Thanks to Eduardo.