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


 * 1) 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. [[File:Step 10. Adding charts 1.png]]
 * 2) Go to the General page of the Properties view.
 * 3) 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.
 * 4) 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


 * 1) 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


 * 1) Drag the Time Plot [[File:Step_5._Adding_charts1.gif‎]] element from the Analysis page of the Palette view into the graphical editor (right to the place where you want to locate this chart).
 * 2) Resize it as shown on the figure. [[File:Step 10. Adding charts 2.png]]
 * 3) Go to the General page of the Properties view.
 * 4) Set up the chart’s time diapason. In the Time Window edit box, type: 8 (so the chart will display all the simulation run).
 * 5) Specify data sets to be displayed on the time plot.
 * 6) 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.
 * 7) Add <tt>AdoptersDS</tt> data set in the same way.
 * 8) 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: <tt>0.1</tt>. [[File:Step 10. Adding charts 3.png]]

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.