LineGraphHistogram - theRAPTLab/gsgo GitHub Wiki
[DEPRECATED 2021-08-18: In general, you probably want to use the Bar Graph Histogram feature. This still works though.]
Histograms are a crude hack of the existing line graph system, taking advantage of agent support for line graphs to implement a line graph histogram. A proper system would require a whole new set of data and display objects, a fairly involved process. But this at least establishes the basic data you would need.
To actually draw the histogram, create an agent that uses the AgentWidgets feature and bind the graph to the data using bindHistogramToFeatProp
.
Use this to plot a dictionary featProp as a line graph histogram.
featCall AgentWidgets bindLineGraphHistogramToFeatProp <feature> <featureProperty>
Where <feature>
is the name of a feature, e.g. "Population", and <featureProperty>
is a dictionary property in that feature, e.g. "_countsByProp"
- Create a histogram blueprint
{
id: 'Histogram', // used by Histogram
label: 'Histogram',
script: `# BLUEPRINT Histogram
# PROGRAM DEFINE
useFeature Population
useFeature Global
useFeature AgentWidgets
featProp AgentWidgets isLargeGraphic setTo true
`
},
- Create a histogram instance and bind the feature property
{
id: 1400,
name: 'Histogram',
blueprint: 'Histogram',
initScript: `prop x setTo 460
prop y setTo -300
featCall AgentWidgets bindLineGraphHistogramToFeatProp Population _countsByProp`
},