projectmesa / mesa

Mesa is an open-source Python library for agent-based modeling, ideal for simulating complex systems and exploring emergent behaviors.
https://mesa.readthedocs.io
Other
2.38k stars 862 forks source link

How to adapt tick labels for horizontal axis in ChartModule? #1537

Open stefaneidelloth opened 2 years ago

stefaneidelloth commented 2 years ago

Instead of steps I would like to show year numbers on the horizontal axis:

image

=> Can I do so in Python (e.g. by inheriting from ChartModule.py) or do I need to adapt some JavaScript code? Where?

stefaneidelloth commented 2 years ago

The appearance of the chart seems to be "hard coded" in JavaScript:

https://github.com/projectmesa/mesa-geo/blob/master/mesa_geo/visualization/templates/js/ChartModule.js

chart.data.labels.push(control.tick);

The global variable "control" and the tick values are defined in

https://github.com/projectmesa/mesa-geo/blob/f5dc628c3674c7faa42c3a4d2053d6cc69f6fa5e/mesa_geo/visualization/templates/js/runcontrol.js

var control = new MesaVisualizationControl();

wang-boyu commented 2 years ago

This is in fact related to mesa (for some reason the javascript code was just copied over). Would you like to ask over there?

Not sure if it's related but there's an open PR that might be of interest to you: https://github.com/projectmesa/mesa/pull/1139

wang-boyu commented 1 year ago

Issue transferred to mesa for advice

rht commented 1 year ago

I made #1540.