CapacityBar Component

An Echo component which implements the capacity bar similar to that used in Apple's iTunes and Safari Debugger. A capacity bar can be thought of as a linear pie chart.

A progress bar can be simulated with two values, and two colors where the second value is the remaining amount, and the second color is a light gray, i.e. #cccccc

For browsers which do not support the <canvas> HTML element, most notably Microsoft Internet Explorer, this component will degrade and honor the width, height, colors, and values parameters. It will resemble a flat linear pie chart with a 3px beveled border.

Demonstration

Default CapacityBar component, empty 18px by 460px, 20 ticks

CapacityBar component, 40px by 300px, default colors

CapacityBar component, 0px by 0px, defaults to miminal size

CapacityBar component, reflection reflectivity set to 0.3

CapacityBar component, showTicks set to false

CapacityBar component, cornerRadius set to 0.5

CapacityBar component, colors set to red, green, blue
Values set to [50,50,50,50,50,50]

CapacityBar simlulating a progress bar, colors set to red, gray
Values set to [60,40] tickSpacing set to 10

CapacityBar component, tickSpacing set to 750
Values set to [1210, 2095.74, 6400, 3545.2]

CapacityBar - Summary API

                   
package org.informagen.echo.app;

import nextapp.echo.app.Component;
import nextapp.echo.app.Color;
import nextapp.echo.app.Extent;

import java.lang.Number;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CapacityBar extends Component {

    public CapacityBar()
    public CapacityBar(int height, int width)

    public void setWidth(int width)
    public void setWidth(Extent width)
    public Extent getWidth()

    public void setHeight(int height)
    public void setHeight(Extent height)
    public Extent getHeight()
       
    public void setShowTicks(boolean showTicks)
    public boolean isShowTicks() 

    public void setReflectivity(double reflectivity) 
    public double getReflectivity()
       
    public void setCornerRadius(double cornerRadius)
    public double getCornerRadius() 

    public void setTickSpacing(Number tickSpacing) 
    public Number getTickSpacing()
       
    public void setColors(List<Color> colors)
    public List getColors()

    public void setValues(List<Number> values) 
    public List getValues() 
}