How to show particular moth on x-axis of time plot in AnyLogic

I am redrawing the chart to have complete access for changing the month on the x-axis of the plot based on the dataset (I have separate dataset for each month).
The complete redrawn chart code is listed below:

    presentation.remove(timePlotPOT);
int num;
DataSet _item;
List<DataSet> _items = new ArrayList<>(1);

if (var_monthForPop == 1) {
    _item = DBPopinGPIOverTime1;
    _items.add(_item);
} else if (var_monthForPop == 2) {
    _item = DBPopinGPIOverTime2;
    _items.add(_item);
} else if (var_monthForPop == 3) {
    _item = DBPopinGPIOverTime3;
    _items.add(_item);
} else if (var_monthForPop == 4) {
    _item = DBPopinGPIOverTime4;
    _items.add(_item);
} else if (var_monthForPop == 5) {
    _item = DBPopinGPIOverTime5;
    _items.add(_item);
} else if (var_monthForPop == 6) {
    _item = DBPopinGPIOverTime6;
    _items.add(_item);
} else if (var_monthForPop == 7) {
    _item = DBPopinGPIOverTime7;
    _items.add(_item);
} else if (var_monthForPop == 8) {
    _item = DBPopinGPIOverTime8;
    _items.add(_item);
} else if (var_monthForPop == 9) {
    _item = DBPopinGPIOverTime9;
    _items.add(_item);
} else if (var_monthForPop == 10) {
    _item = DBPopinGPIOverTime10;
    _items.add(_item);
} else if (var_monthForPop == 11) {
    _item = DBPopinGPIOverTime11;
    _items.add(_item);
} else if (var_monthForPop == 12) {
    _item = DBPopinGPIOverTime12;
    _items.add(_item);
} else {
    _item = DBPopinGPIOverTime;
    _items.add(_item);
}

List<String> _titles = new ArrayList<>(1);
_titles.add("Clients In GPI Over Time");

List<Chart2DPlot.Appearance> _appearances = new ArrayList<>(1);
_appearances.add(new Chart2DPlot.Appearance(darkOrange, true, true, Chart.INTERPOLATION_LINEAR, 1.0, Chart.POINT_NONE));


    timePlotPOT = new TimePlot(
            Main.this, true, 8200.0, 160.0,
            800.0, 220.0,
            null, null,
            50.0, 30.0,
            690.0, 160.0, white, black, black,
            30.0, Chart.NONE,
             scenario.ModelStopTime * month(), Chart.WINDOW_MOVES_WITH_TIME, "dd MMM", Chart.SCALE_AUTO,
            0, 0, Chart.GRID_DEFAULT, Chart.GRID_DEFAULT,
            darkGray, darkGray, _items, _titles, _appearances);

presentation.add(timePlotPOT);
//max(_item.size(),1)

Now in the code scenario.ModelStopTime = 12 which is good as I want to show the plot of total 12 months.The Image of the 12 month chart is given below.
enter image description here

The problem is when I switch to the month one, the dataset which is visible is only one month data but the x-axis value still showing 12 months. How can I change it to that one particular moth for which the dataset is visible.
enter image description here

I simple words lets say its October month dataset so the x axis of the time plot should also show OCT month only, instead of showing whole 12 months.

Leave a Reply

Your email address will not be published.