Implementing a bar chart

edited March 2016 in Library Questions

I was using gicentre but I don't think I can make it interactive or have it become a stacked bar chart. If I implement my own, I would just use rects or lines with thick strokes right? How would the axis and height of the bars work? If I want the bar charts to fit in a portion of my sketch canvas, say 500x500, What would I have to do to draw them accordingly to that? Some of my data are have values in the thousands. Would I need to use the map function or divide the values up?

Thanks

Tagged:

Answers

  • edited March 2016

    You need to create a class representing the chart, optionally, I would create separate class for data series (your bars), as you want more then one series. You need to have variables for position and size of chart itself, max and min values of y axis, number of cols, and other stuff you usually have in Excel bar chart. It does not matter if you have thousands, millions or anything - the hight of your rects will be calculated like (value/max y-axis value)*chart height.

    Start simple and add functionality step by step.

    Remember that y is reversed to chart in processing coordinate system.

  • Sorry about that. I thought since one was asking about implementation and the other asking about a Library that it would be different. Would millions, thousands, or hundreds be the value or the height in that equation?

  • Is it possible to transpose the gicentre barcharts to the left instead of the right when we set transposeAxis(true)?

  • Answer ✓

    (you can edit titles and sections easily enough.

    it's mainly that having two open threads on the same question splits the answers to that question which is duplicated effort or just plain confusing.)

  • Okay I understand. Sorry about that. Would you happen to know how the tooltip class works with the barcharts? I want to grab the data from the bar chart, but i'm not sure how it works with the barchart class.

Sign In or Register to comment.