0 / 0
Displaying multiple scenarios in a Decision Optimization Visualization view
Last updated: Apr 18, 2024
Displaying multiple scenarios in a Decision Optimization Visualization view

You can display more than one scenario on a page in the Visualization view to compare and validate your model and data.

About this task

The following procedure shows you how to display two scenarios in the same Visualization view using a bar chart with the Chart Widget Editor. An example also follows that shows you how to display two scenarios in a Vega Chart bar chart.

Procedure

For example, to display bar charts for two scenarios in the Visualization view:

  1. Click Chart and configure it by clicking the pencil icon.
  2. In the Chart Widget Editor, expand the Select scenario menu, and choose Scenario 1 (assuming that your current scenario is Scenario 2) so that you have both scenario 1 and scenario 2 listed.
  3. In the Table field, select the Solution data option and select solution from the drop-down list.
  4. In the bar chart pane, select Descending for the Category order, Y-axis for the Bar type and click OK to close the Chart Widget Editor. A second bar chart is then displayed showing you the solution results for scenario 2.
  5. Re-edit the chart and select @Scenario in the Split by field of the Bar chart pane.

Results

You then obtain both scenarios in the same bar chart:

Chart with two scenarios displayed in one chart.

You can select many different types of charts in the Chart Widget Editor.

Example

To display bar charts for two scenarios using the Vega Chart widget, you can similarly choose Solution data > solution to display the same data, select value, and name in both the x and y fields in the Chart section of the Vega Chart Widget Editor. Then, in the Mark section, select @Scenario for the color field. This selection gives you the following bar chart with the two scenarios on the same y-axis, distinguished by different colors.

Vega chart showing 2 scenarios

If you re-edit the chart and select @Scenario for the column facet, you obtain the two scenarios in separate charts side by side as follows:

Vega charts showing 2 scenarios side by side.

You can use many different types of charts that are available in the Mark field of the Vega Chart Widget Editor.

You can also select the JSON tab in all the widget editors and configure your charts by using the JSON code. A more advanced example of JSON code is provided in the Vega Chart widgets in Decision Optimization experiments section.

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more