Response title
This is preview!




Click on Join Now to Sign Up
import org.gicentre.utils.stat.*; // For chart classes. // Draws a simple chart that can be dragged with the mouse. // Version 1.1, 21st September, 2010. // Author Jo Wood, giCentre. BarChart barChart; PVector graphPosition; // Initialises the chart to be drawn. void setup() { size(640,300); smooth(); PFont font = createFont("Helvetica",11); textFont(font,10); graphPosition = new PVector(10,10); barChart = new BarChart(this); barChart.setData(new float[] {7657,9649,9767,12167,15154,18200,23124,28645}); barChart.setBarLabels(new String[] {"1930","1940","1950","1960", "1970","1980","1990","2000"}); barChart.setBarColour(color(200,80,80,100)); barChart.setBarGap(2); barChart.setValueFormat("$###,###"); barChart.showValueAxis(true); barChart.showCategoryAxis(true); } // Draws the chart and title at the last dragged mouse position. void draw() { background(240,250,240); textSize(8); barChart.draw(graphPosition.x,graphPosition.y,250,150); textSize(12); fill(120); text("Income per person, UK", graphPosition.x+45,graphPosition.y+15); } // Updates the last dragged mouse position. void mouseDragged() { graphPosition.x = mouseX; graphPosition.y = mouseY; }