Average response time from histogram

Hi,

Given that I have the histogram below, how do I get the average out of it and create a graph as shown?

Thanks

# HELP response_duration_histogram Balance response duration (ms)
# TYPE response_duration_histogram histogram
response_duration_histogram_bucket{operation="balance",le="10"} 0
response_duration_histogram_bucket{operation="balance",le="50"} 42
response_duration_histogram_bucket{operation="balance",le="90"} 152
response_duration_histogram_bucket{operation="balance",le="130"} 298
response_duration_histogram_bucket{operation="balance",le="170"} 405
response_duration_histogram_bucket{operation="balance",le="210"} 467
response_duration_histogram_bucket{operation="balance",le="250"} 503
response_duration_histogram_bucket{operation="balance",le="290"} 503
response_duration_histogram_bucket{operation="balance",le="330"} 503
response_duration_histogram_bucket{operation="balance",le="+Inf"} 503
response_duration_histogram_sum{operation="balance"} 60569
response_duration_histogram_count{operation="balance"} 503

Screen Shot 2020-09-22 at 23.46.08 (1)