@Override
  protected void decorate(
      NumberAnalyzerResult result, DCTable table, final DisplayChartCallback displayChartCallback) {
    // find the std. deviation row number.
    int rowNumber = -1;
    {
      for (int i = 0; i < table.getRowCount(); i++) {
        Object value = table.getValueAt(i, 0);
        if (NumberAnalyzer.MEASURE_STANDARD_DEVIATION.equals(value)) {
          rowNumber = i;
          break;
        }
      }
      if (rowNumber == -1) {
        throw new IllegalStateException("Could not determine Std. deviation row number!");
      }
    }

    Crosstab<?> crosstab = result.getCrosstab();

    final InputColumn<? extends Number>[] columns = result.getColumns();
    int columnNumber = 1;
    for (final InputColumn<? extends Number> column : columns) {
      final CrosstabNavigator<?> nav =
          crosstab.where(NumberAnalyzer.DIMENSION_COLUMN, column.getName());

      final Number numRows =
          (Number)
              nav.where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_ROW_COUNT).get();
      if (numRows.intValue() > 0) {
        final Number standardDeviation =
            (Number)
                nav.where(
                        NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_STANDARD_DEVIATION)
                    .get();
        if (standardDeviation != null) {

          ActionListener action =
              new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                  final Number mean =
                      (Number)
                          nav.where(NumberAnalyzer.DIMENSION_MEASURE, NumberAnalyzer.MEASURE_MEAN)
                              .get();
                  final Number min =
                      (Number)
                          nav.where(
                                  NumberAnalyzer.DIMENSION_MEASURE,
                                  NumberAnalyzer.MEASURE_LOWEST_VALUE)
                              .get();
                  final Number max =
                      (Number)
                          nav.where(
                                  NumberAnalyzer.DIMENSION_MEASURE,
                                  NumberAnalyzer.MEASURE_HIGHEST_VALUE)
                              .get();

                  final NormalDistributionFunction2D normalDistributionFunction =
                      new NormalDistributionFunction2D(
                          mean.doubleValue(), standardDeviation.doubleValue());
                  final XYDataset dataset =
                      DatasetUtilities.sampleFunction2D(
                          normalDistributionFunction,
                          min.doubleValue(),
                          max.doubleValue(),
                          100,
                          "Normal");

                  final JFreeChart chart =
                      ChartFactory.createXYLineChart(
                          "Normal distribution of " + column.getName(),
                          column.getName(),
                          "",
                          dataset,
                          PlotOrientation.VERTICAL,
                          false,
                          true,
                          false);
                  ChartUtils.applyStyles(chart);
                  Marker meanMarker =
                      new ValueMarker(
                          mean.doubleValue(), WidgetUtils.BG_COLOR_BLUE_DARK, new BasicStroke(2f));
                  meanMarker.setLabel("Mean");
                  meanMarker.setLabelOffset(new RectangleInsets(70d, 25d, 0d, 0d));
                  meanMarker.setLabelFont(WidgetUtils.FONT_SMALL);
                  chart.getXYPlot().addDomainMarker(meanMarker);

                  final ChartPanel chartPanel = new ChartPanel(chart);
                  displayChartCallback.displayChart(chartPanel);
                }
              };

          DCPanel panel =
              AbstractCrosstabResultSwingRenderer.createActionableValuePanel(
                  standardDeviation, Alignment.RIGHT, action, "images/chart-types/line.png");
          table.setValueAt(panel, rowNumber, columnNumber);
        }
      }

      columnNumber++;
    }

    super.decorate(result, table, displayChartCallback);
  }
 protected Column getDefaultMappedColumn(InputColumn<?> inputColumn, Table table) {
   // automatically select a column by name, if it exists
   return table.getColumnByName(inputColumn.getName());
 }