This function will help you to fetch the response percentage for a specific custom variable. You can also filter out the average response value by passing the filter in the function.
getPercentageForCustomVariable(customVariable, customVariableValue, filter, function(value) {
//You will get the value here, so write your code here
})
Refer to Filters for more information