On 4/17/16, 7:09 PM, "MASON Multiagent Simulation Toolkit on behalf of Sean Luke" <[log in to unmask] on behalf of [log in to unmask]> wrote: >On Apr 17, 2016, at 8:23 PM, Russell Thomas ><[log in to unmask]> wrote: > >> Currently, using the Console "Model" tab and inspectors for data, the >>bar and pie chart values ("y axis" in bar chart) is generated from >>*counts* of the Objects[ ]. >> >> I suggest adding a new feature to produce bar and pie charts from data, >>where each datum is a pair: label (String) and value (double). I have >>implemented this using the code below, but it would be nice if this were >>added to the existing classes rather than as a separate chart type >>("Make Bar Chart from Values") > > >0. Okay I gotta think about this; I had put the pause button on >inspecting pairs. >One reason I (for the moment) stuck to only inspecting collections or >arrays of objects was that Inspectors are most commonly used to inspect >existing data from a model, that is, data that's designed for the >simulation rather than customized for visualization purposes. I was >hesitant to add custom classes like BarChartDatum. Still wondering if >there is any standard class or interface we could use with both a double >and a String (probably not). Also it should probably also support Maps. My use case is general, I think. I have many variables that track or measure some aspect of the simulation, or components. Most of these I store in my extension of SimState and update in a separate Steppable tabulateMetrics(). These metrics aren't usually customized for visualization, though some are. Collectively, these metrics are the "vital signs" of the simulation, or components, or classes of agents, or agents. I need them for debugging, testing, validation, and even experimental results. From the Console, it's a two step procedure to build up time series charts. First, "View" the data array, then one by one add them to a "Chart". I'm just looking for a similar (one-step) procedure for bar charts. (OK, pie charts, too ... but they must die! :-) ) As for adding a "Datum" class to sim.util or similar package, I don't know if there is a compelling case for that. I created one in this case because I wanted to pass a single array of Object [ ]. For all I know, there is some standard Java class for this. > >1. I'm confused by your implementation approach: BarCharts and PieCharts >already can add and update series in the form of a String[] and a >double[]. Is there a reason you didn't use that facility to build your >custom inspector? It would seem to be much easier to do that. Yes, I could have done programmatic calls to add/update series for String[ ] labels and double [ ] amounts. I backed into this design because I was aiming to preserve the UI and interface in the Console, where a Bean of type Object [ ] is inspected to produce a Bar or Pie chart. (Pie charts must die, IMO. But that is a separate argument :-) I had not originally intended to modify MASON at all, but only to extend it with my own classes. But this grew complicated and I was having trouble getting it to work. In the time I spent on this, I clearly could have written a custom inspector and/or a custom chart in it's own display. Sigh. This was a side-task that I thought I could do quickly. Russ >