# Chart Images Generation

Schedule the Chart Generation |

The second step is to schedule the chart generation. To generate a chart image, the chart definition or program is added to the Chart Scheduler. The Chart Scheduler allows you to schedule chart image generation either on a fixed schedule or an on-demand basis. Entries can be added, modified or deleted in the Chart Scheduler by accessing Chart Image Generation Schedule Maintenance.

## Chart Image Generation Schedule Maintenance

The Chart Image Generation Schedule Maintenance utility displays a list of all scheduled entries that have been added, as indicated by the All entries selection in the drop box above this list. In addition to adding, changing or removing entries, you can refresh the list, view a report showing schedule details of all listed items, and generate a chart image on demand.

(Chart Image Generation Schedule Maintenance was added in PxPlus v11.50.)

The Chart Image Generation Schedule Maintenance window can be accessed by using various methods, and the particular method used determines the level of information presented.

For example, you can invoke the general maintenance window (above), which shows a list of all schedule entries, from the PxPlus IDE Main Launcher. To do this, first expand the Graphical Application Builder (NOMADS) category, and then expand the Utilities category. Under the Utilities category, select Chart Image Scheduler. Another method is to select Chart Image Scheduler from the Utilities menu on the NOMADS Session Manager window.

More specifically, you can first select a library from within NOMADS, and then in Library Object Selection, select Chart Image Scheduler from the Utilities menu to display schedule entries only for that library.

Chart Image Generation Schedule Maintenance can also be invoked from your application when a query is invoked. If the query has public chart definitions associated with it, the Schedule Chart Image Generation option appears on the popup menu, and the Chart Image Generation Schedule Maintenance utility will display any entries associated with that query.

#### Note:
To display a list of all schedule entries, rather than only those associated with a particular library or query, select All entries from the drop-down list located at the top of window.

Another method for accessing the Chart Image Generation Schedule Maintenance utility is by using the CHARTSCHED command line program. It can be invoked from the Command line at several levels:

Command | Description
chartsched | General maintenance based on current directory and subdirectories
chartschedDirectory | Maintenance for all schedule items for the specified directory and subdirectories Example: chartsched/work
chartschedLibrary | Maintenance for all schedule items for the specified library Example: chartschedtest.en
chartschedLibrary,QueryPanel | Maintenance for all schedule items for the specified query Example: chartsched/work/test.en, testquery
chartschedScheduleEntryName | Item maintenance for the specified item Example: chartschedSales Totals

#### Note:
When invoking Chart Image Generation Schedule Maintenance for the first time, the chart schedule file, chartsched, is created in the local or prefix directory.

## Adding a Chart to the Schedule

Using Chart Image Generation Schedule Maintenance, you can add both AutoChart definitions and program references to the schedule.

To add an AutoChart definition to the schedule, click the Add Chart button in Chart Image Generation Schedule Maintenance. Depending on the method used to invoke this utility, a tree-view structure lists all of the public AutoChart definitions that exist at the current display level and lower.

At the general maintenance level, you can specify a Starting Directory, which is used as the top level of the tree-view structure. Selecting a Chart Definition from this display opens the Chart Scheduler window.

For a chart schedule entry, the Chart Scheduler requires the following information:

Schedule Item Name | Unique name used to identify each schedule entry. The name is initially derived from the name of the chart definition; however, this can be changed.
Location of Chart Definition |
Directory | Path to the directory where the panel library containing the query definition with the selected AutoChart definition is stored. The directory path is optional if the panel library file is accessible using a simple path; i.e. it is in the current directory or a directory defined in the prefix settings. The value of the directory can be fixed or an expression. If the specified directory does not exist, you are prompted with a choice to use it or not.
Expression | Select this check box if the directory is an expression.
Library Name | (Display Only) Name of the panel library in which the AutoChart definition is located.
Query Name | (Display Only) Name of the query to which the AutoChart definition is associated.
Chart Name | (Display Only) Name of the AutoChart definition used to generate the chart image.
Scheduling Information |
Frequency | Frequency at which the chart image is to be generated when the Chart Scheduler is running. Selections are:
5 minutes | 15 minutes | 1 hour | 3 hours | 12 hours
10 minutes | 30 minutes | 2 hours | 6 hours | 24 hours
An On Demand selection is also available. On Demand means that instead of going through the Chart Scheduler to generate the image, the image can be generated by clicking the Generate button in Chart Image Generation Schedule Maintenance, or it can be generated programmatically by calling the "*gencharts;Generate_Chart" program. See Generate the Chart Image for information about On Demand Chart Generation.
Next Image Generation | When adding a new schedule entry: Enter the date and time at which the chart is to be initially generated. You can type the date using the YYYY-MM-DD format or click the Calendar button to select the date. The time is entered using the 24-hour format. When modifying an existing schedule entry: This indicates the date and time of the next scheduled generation.
Last Image Generated | For an existing schedule entry: This is the date and time at which the chart was last generated using either the fixed schedule or on-demand method. (Display Only) When adding a new schedule entry: This field is hidden.
Image Information |
Output to *mytiles subdirectory | (As of PxPlus 2021, this option is no longer available for selection.) For any existing schedule entries that were defined prior to PxPlus 2021 with this check box On, this option will display a check mark and be disabled. The functionality associated with this option will not change, which is to output the image to a *mytiles subdirectory if the image is to be used by a Windows Tile using the PxPlus MyTiles™ utility.
Directory | (As of PxPlus 2021, this option is no longer available for selection.) For any existing schedule entries that were defined prior to PxPlus 2021 with the Output to *mytiles subdirectory check box On, the Directory option will display and be disabled; otherwise, it will be hidden if the check box was Off.
Image Path or HTML File | Name of the image file to be generated. The name must include the image file suffix, i.e. .png, .gif, .jpg. If the Output to *mytiles subdirectory check box is On, enter the Image File. The Image File entered must be a simple path name. If the Output to *mytiles subdirectory check box is Off, enter the Image Path or HTML File. This can be a simple or full path name. The path can be a Fixed value or Expression.
Image Shape | If the Output to *mytiles subdirectory check box is On, an image shape must be selected, either Square or Wide.
Image Size in pixels | Enter the Width and Height of the image in pixels. If the Output to *mytiles subdirectory check box is On, only the Width can be entered. The Height is calculated based on the specified shape. If the Output to *mytiles subdirectory check box is Off, the Width and the Height can be entered.
Test | Button used to generate and view a chart image based on the current definition. When viewing the chart image, a check box option that allows you to delete the image file is available.

Chart images can also be created by writing a program to create the chart and its image. To add this type of chart to the Chart Scheduler, click the Add Program button in Chart Image Generation Schedule Maintenance. A modified version of the Chart Scheduler is displayed.

For a chart schedule entry using a program, the Chart Scheduler requires the following information:

Schedule Item Name | Unique name used to identify each schedule entry. The name is initially derived from the name of the chart definition; however, this can be changed.
Program Information |
(Input field) | Path of the program that generates the chart image. Path may be a Fixed value or an Expression. If the specified path does not exist, a message displays with a choice to use it or not.
Expression | Select this check box if the directory is an expression.
Scheduling Information |
Frequency | See Adding a Chart to the Schedule.
Next Image Generation | See Adding a Chart to the Schedule.
Last Image Generated | See Adding a Chart to the Schedule.

## Removing a Chart from the Schedule

From the list of schedule entries displayed in Chart Image Generation Schedule Maintenance, click to highlight the schedule entry to be deleted and select the Remove button.

## Modifying a Schedule Entry

From the list of schedule entries displayed in Chart Image Generation Schedule Maintenance, click to highlight the schedule entry to be modified and select the Properties button. The Chart Scheduler window opens with the information for the selected entry displayed for editing.