controlP5
Class Chart

java.lang.Object
  extended by controlP5.Controller
      extended by controlP5.Chart
All Implemented Interfaces:
CDrawable, ControllerInterface, ControlP5Constants

public class Chart
extends Controller

Use charts to display float array data as line chart, yet experimental, but see the ControlP5chart example for more details.

+Example
/**
 * press any key to change input data for the chart.
 */
import controlP5.*;

ControlP5 controlP5;
Chart myChart;
float[] f;
import processing.opengl.*;

void setup() {
  size(600, 400);
  smooth();

  frameRate(30);
  controlP5 = new ControlP5(this);
  myChart = controlP5.addChart("Hello", 20, 20, 100, 100);
  controlP5.addButton("hello", 2, 200, 200, 100, 20);
  controlP5.addSlider("slider", 0, 100, 50, 320, 200, 100, 20).setNumberOfTickMarks(11);
  myChart.setView(new ChartBarDisplay(myChart));
  myChart.setStrokeWeight(1);
  ChartDataSet cds = myChart.addDataSet();
  cds.getColor().setForeground(color(255, 150));
  f = new float[10];
  for (int i=0;i {

  Chart myChart;

  public ChartBarDisplay(Chart theChart) {
    myChart = theChart;
  }

  public void display(PApplet p, Chart theController) {
    p.pushMatrix();
    for (int n=0;n

Nested Class Summary
 class Chart.ChartViewArea
           
 class Chart.ChartViewBar
           
 class Chart.ChartViewBarCentered
           
 class Chart.ChartViewLine
           
 class Chart.ChartViewPie
           
 
Field Summary
static int AREA
           
static int BAR
           
static int BAR_CENTERED
           
static int HISTOGRAM
           
static int LINE
           
static int PIE
           
 
Fields inherited from class controlP5.Controller
autoHeight, autoSpacing, autoWidth
 
Fields inherited from interface controlP5.ControlP5Constants
acceptClassList, ACTION_BROADCAST, ACTION_ENTER, ACTION_LEAVE, ACTION_PRESSED, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTIVE, ALL, ALT, ARC, ARRAY, BACKSPACE, BASELINE, BITFONT, BOOLEAN, BOTTOM, BOTTOM_OUTSIDE, CAPTIONLABEL, CENTER, COMMANDKEY, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LEFT_OUTSIDE, LOAD, MENU, METHOD, MOVE, MULTIPLES, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, RIGHT_OUTSIDE, SAVE, SHIFT, SINGLE, SINGLE_COLUMN, SINGLE_ROW, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TOP_OUTSIDE, TRANSITION_WAIT_FADEIN, TWO_PI, UP, VALUELABEL, VERBOSE, VERTICAL, WAIT
 
Method Summary
 Chart addData(ChartData theItem)
           
 Chart addData(ChartDataSet theChartData, float theValue)
           
 Chart addData(float theValue)
           
 Chart addData(java.lang.String theSetIndex, ChartData theItem)
           
 Chart addData(java.lang.String theSetIndex, float theValue)
           
 Chart addDataSet(java.lang.String theName)
           
 Chart addFirst(float theValue)
           
 Chart addFirst(java.lang.String theSetIndex, float theValue)
           
 ChartData getData(java.lang.String theIndex, int theItemIndex)
           
 java.util.LinkedHashMap getDataSet()
           
 ChartDataSet getDataSet(java.lang.String theIndex)
           
 java.lang.String getInfo()
           
 int getResolution()
           
 float getStrokeWeight()
           
 float[] getValuesFrom(java.lang.String theIndex)
           
 void onEnter()
           
 void onLeave()
           
 Chart push(float theValue)
           
 Chart push(java.lang.String theSetIndex, float theValue)
           
 Chart removeData(ChartData theItem)
           
 Chart removeData(int theItemIndex)
           
 Chart removeData(java.lang.String theSetIndex, ChartData theItem)
           
 Chart removeData(java.lang.String theSetIndex, int theItemIndex)
           
 Chart removeDataSet(java.lang.String theIndex)
           
 Chart removeLast()
           
 Chart removeLast(java.lang.String theSetIndex)
           
 Chart setColors(java.lang.String theSetIndex, int[] theColors)
           
 Chart setData(float[] theValues)
           
 Chart setData(int theItemIndex, ChartData theItem)
           
 Chart setData(java.lang.String theSetIndex, float[] theValues)
           
 Chart setData(java.lang.String theSetItem, int theItemIndex, ChartData theItem)
           
 Chart setDataSet(ChartDataSet theItems)
           
 Chart setDataSet(java.lang.String theSetIndex, ChartDataSet theChartData)
           
 Chart setRange(float theMin, float theMax)
           
 Chart setResolution(int theValue)
          ?
 Chart setStrokeWeight(float theWeight)
           
 Chart setValue(float theValue)
           
 Chart setView(int theType)
           
 int size()
           
 java.lang.String toString()
           
 Chart updateData(float[] theValues)
           
 Chart updateData(java.lang.String theSetIndex, float[] theValues)
           
 
Methods inherited from class controlP5.Controller
add, addCallback, addListener, align, bringToFront, bringToFront, changeValue, getAbsolutePosition, getAddress, getArrayValue, getArrayValue, getBehavior, getCaptionLabel, getColor, getControllerPlugList, getControlWindow, getDecimalPrecision, getDefaultValue, getHeight, getId, getLabel, getMax, getMin, getName, getParent, getPickingColor, getPosition, getProperty, getProperty, getStringValue, getTab, getValue, getValueLabel, getWidth, getWindow, hide, init, isActive, isBroadcast, isInside, isLabelVisible, isListening, isLock, isMouseOver, isMousePressed, isMoveable, isUpdate, isVisible, keyEvent, linebreak, listen, listenerSize, lock, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, plugTo, plugTo, plugTo, plugTo, registerProperty, registerProperty, registerTooltip, remove, remove, removeBehavior, removeCallback, removeCallback, removeListener, removeProperty, removeProperty, setAbsolutePosition, setAddress, setArrayValue, setArrayValue, setBehavior, setBroadcast, setCaptionLabel, setColor, setColorActive, setColorBackground, setColorCaptionLabel, setColorForeground, setColorValueLabel, setDecimalPrecision, setDefaultValue, setGroup, setGroup, setHeight, setId, setImage, setImage, setImages, setImages, setImages, setLabelVisible, setLock, setMax, setMin, setMouseOver, setMousePressed, setMoveable, setParent, setPosition, setPosition, setSize, setSize, setStringValue, setTab, setTab, setUpdate, setValueLabel, setView, setView, setVisible, setWidth, show, unlock, unplugFrom, unplugFrom, unregisterTooltip, update, updateAbsolutePosition, updateEvents, updateInternalEvents, updateSize
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface controlP5.ControllerInterface
continuousUpdateEvents, draw, parent, setColorLabel, setColorValue, setLabel
 
Methods inherited from interface controlP5.CDrawable
draw
 

Field Detail

AREA

public static final int AREA
See Also:
Constant Field Values

BAR

public static final int BAR
See Also:
Constant Field Values

BAR_CENTERED

public static final int BAR_CENTERED
See Also:
Constant Field Values

HISTOGRAM

public static final int HISTOGRAM
See Also:
Constant Field Values

LINE

public static final int LINE
See Also:
Constant Field Values

PIE

public static final int PIE
See Also:
Constant Field Values
Method Detail

addData

public Chart addData(ChartData theItem)

addData

public Chart addData(ChartDataSet theChartData,
                     float theValue)

addData

public Chart addData(float theValue)

addData

public Chart addData(java.lang.String theSetIndex,
                     ChartData theItem)

addData

public Chart addData(java.lang.String theSetIndex,
                     float theValue)

addDataSet

public Chart addDataSet(java.lang.String theName)

addFirst

public Chart addFirst(float theValue)

addFirst

public Chart addFirst(java.lang.String theSetIndex,
                      float theValue)

getData

public ChartData getData(java.lang.String theIndex,
                         int theItemIndex)

getDataSet

public java.util.LinkedHashMap getDataSet()

getDataSet

public ChartDataSet getDataSet(java.lang.String theIndex)

getInfo

public java.lang.String getInfo()
Overrides:
getInfo in class Controller
Returns:
String

getResolution

public int getResolution()

getStrokeWeight

public float getStrokeWeight()

getValuesFrom

public float[] getValuesFrom(java.lang.String theIndex)

onEnter

public void onEnter()

onLeave

public void onLeave()

push

public Chart push(float theValue)

push

public Chart push(java.lang.String theSetIndex,
                  float theValue)

removeData

public Chart removeData(ChartData theItem)

removeData

public Chart removeData(int theItemIndex)

removeData

public Chart removeData(java.lang.String theSetIndex,
                        ChartData theItem)

removeData

public Chart removeData(java.lang.String theSetIndex,
                        int theItemIndex)

removeDataSet

public Chart removeDataSet(java.lang.String theIndex)

removeLast

public Chart removeLast()

removeLast

public Chart removeLast(java.lang.String theSetIndex)

setColors

public Chart setColors(java.lang.String theSetIndex,
                       int[] theColors)

setData

public Chart setData(float[] theValues)

setData

public Chart setData(int theItemIndex,
                     ChartData theItem)

setData

public Chart setData(java.lang.String theSetIndex,
                     float[] theValues)

setData

public Chart setData(java.lang.String theSetItem,
                     int theItemIndex,
                     ChartData theItem)

setDataSet

public Chart setDataSet(ChartDataSet theItems)

setDataSet

public Chart setDataSet(java.lang.String theSetIndex,
                        ChartDataSet theChartData)

setRange

public Chart setRange(float theMin,
                      float theMax)

setResolution

public Chart setResolution(int theValue)
?

Parameters:
theValue -
Returns:

setStrokeWeight

public Chart setStrokeWeight(float theWeight)

setValue

public Chart setValue(float theValue)
Specified by:
setValue in interface ControllerInterface
Specified by:
setValue in class Controller
Parameters:
theValue - float

setView

public Chart setView(int theType)

size

public int size()

toString

public java.lang.String toString()
Overrides:
toString in class Controller

updateData

public Chart updateData(float[] theValues)

updateData

public Chart updateData(java.lang.String theSetIndex,
                        float[] theValues)


processing library controlP5 by Andreas Schlegel. (c) 2012