Simulation with AnyLogic/System Dynamics/Step 10. Adding charts
Step 10. Adding Charts
You can also observe how the values of variables change during the simulation using charts. Namely, we want to examine the adopter and potential adopters populations dynamics. We will also use the same chart to show how the adoption rate changes in our model.
Create a data set for the PotentialAdopters variable
- In the graphical editor, right-click the PotentialAdopters variable and choose Create Data Set from the popup menu. The data set PotentialAdoptersDS will be created. It will store the history of the variable that can be displayed on the chart. Move the data set icon aside like shown on the figure below.
- Go to the General page of the Properties view.
- Specify the data set title in the Title edit box: # of potential adopters. It will be displayed in the legend displayed for this data item in the chart.
- Clear the Show at Runtime check box to prevent showing the data set icon in the presentation window at model runtime.
Create one more data set for Adopters
- Create data set for the Adopters variable in the same way and set up its title: # of adopters.
Draw a time plot displaying adopter and potential adopter population pools
- Drag the Time Plot element from the Analysis page of the Palette view into the graphical editor (right to the place where you want to locate this chart).
- Resize it as shown on the figure.
- Go to the General page of the Properties view.
- Set up the chart’s time diapason. In the Time Window edit box, type: 8 (so the chart will display all the simulation run).
- Specify data sets to be displayed on the time plot.
- Add PotentialAdoptersDS data set to be visualized on this plot by clicking the Add Data Set button and defining settings for the data set in the property section above. Choose PotentialAdoptersDS data set from the Data Set drop-down list. Choose the first option from the Point Style drop-down list to turn off indicating data set values with a marker.
- Add AdoptersDS data set in the same way.
- Define how the plot will be updated with new data set values. At the botom of the properties page, choose Update automatically option and specify the update rate in the Recurrence (in time units) edit box to the right: 0.1.
Now you can run the model and examine the trend of potential adopter and adopter populations over time. You will see classic S-shaped diffusion curves.