Skip to content

Commit

Permalink
Implemented Item + getDimension() accessor on Range
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsmidsrod committed Apr 21, 2010
1 parent 96faf47 commit bb7d6a0
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
62 changes: 62 additions & 0 deletions src/no/smidsrod/robin/svg/library/Item.java
@@ -1,5 +1,6 @@
package no.smidsrod.robin.svg.library;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -9,8 +10,69 @@
*/
public class Item {

private String name = "";

private Color color = new Color(0, true); // Completely transparent

private boolean highlighted = false;

private List<Value> valueList = new ArrayList<Value>();

/**
* @return The name of this Item - default is the empty string
*/
public String getName() {
return name;
}

/**
* @param name
* Set the name of the Item. If you specify a null value, it will
* be converted to the empty string.
*/
public void setName(String name) {
this.name = (name == null) ? "" : name;
}

/**
* @return Get the current color assigned to the Item.
*/
public Color getColor() {
return color;
}

/**
* @param color
* Set the Item to the specified color. If you specify a null
* value, the Item will become completely transparent.
*/
public void setColor(Color color) {
this.color = (color == null) ? new Color(0, true) : color;
}

/**
* @return Returns true if this Item is supposed to be highlighted in the
* chart.
*/
public boolean isHighlighted() {
return highlighted;
}

/**
* @param highlighted
* Specify true if you want this Item highlighted in the chart.
* The default is false.
*/
public void setHighlighted(boolean highlighted) {
this.highlighted = highlighted;
}

/**
* @return Returns a list of Value objects that can be manipulated via the
* List interface methods. Each Value instance can contain a value
* for each dimension the chart class supports. This makes it quite
* easy to store information for multi-dimensional charts.
*/
public List<Value> getValueList() {
return valueList;
}
Expand Down
12 changes: 10 additions & 2 deletions src/no/smidsrod/robin/svg/library/Range.java
Expand Up @@ -36,6 +36,14 @@ public Range(int dimension, List<Item> itemList) {
this.itemList = itemList;
}

/**
* @return Returns the dimension this Range represents. The first dimension
* is 0 (not 1) if automatically initialized from AbstractChart.
*/
public int getDimension() {
return dimension;
}

/**
* @param min
* Set the axis minimum value to the specified value.
Expand Down Expand Up @@ -193,8 +201,8 @@ public int getGridlineCount() {
}

/**
* @return The difference between the maximum and minimum value as an absolute
* value.
* @return The difference between the maximum and minimum value as an
* absolute value.
*/
private double calcRange() {
double max = getMax();
Expand Down

0 comments on commit bb7d6a0

Please sign in to comment.