private void calculateMaxViewport() {
        float maxZ = Float.MIN_VALUE;
        tempMaximumViewport.set(Float.MAX_VALUE, Float.MIN_VALUE, Float.MIN_VALUE, Float.MAX_VALUE);
        BubbleChartData data = dataProvider.getBubbleChartData();
        // TODO: Optimize.
        for (BubbleValue bubbleValue : data.getValues()) {
            if (Math.abs(bubbleValue.getZ()) > maxZ) {
                maxZ = Math.abs(bubbleValue.getZ());
            }
            if (bubbleValue.getX() < tempMaximumViewport.left) {
                tempMaximumViewport.left = bubbleValue.getX();
            }
            if (bubbleValue.getX() > tempMaximumViewport.right) {
                tempMaximumViewport.right = bubbleValue.getX();
            }
            if (bubbleValue.getY() < tempMaximumViewport.bottom) {
                tempMaximumViewport.bottom = bubbleValue.getY();
            }
            if (bubbleValue.getY() > tempMaximumViewport.top) {
                tempMaximumViewport.top = bubbleValue.getY();
            }
        }

        maxRadius = (float) Math.sqrt(maxZ / Math.PI);

        // Number 4 is determined by trials and errors method, no magic behind it:).
        bubbleScaleX = tempMaximumViewport.width() / (maxRadius * 4);
        if (bubbleScaleX == 0) {
            // case for 0 viewport width.
            bubbleScaleX = 1;
        }

        bubbleScaleY = tempMaximumViewport.height() / (maxRadius * 4);
        if (bubbleScaleY == 0) {
            // case for 0 viewport height.
            bubbleScaleY = 1;
        }

        // For cases when user sets different than 1 bubble scale in BubbleChartData.
        bubbleScaleX *= data.getBubbleScale();
        bubbleScaleY *= data.getBubbleScale();

        // Prevent cutting of bubbles on the edges of chart area.
        tempMaximumViewport.inset(-maxRadius * bubbleScaleX, -maxRadius * bubbleScaleY);

        minRawRadius = ChartUtils.dp2px(density, dataProvider.getBubbleChartData().getMinBubbleRadius());
    }
Calculate bubble radius and center x and y coordinates. Center x and x will be stored in point parameter, radius
will be returned as float value.
hellocharts-library/src/lecho/lib/hellocharts/renderer/BubbleChartRenderer.java