Add a time chart to the simulation

@param chartID
@param xAxisLabel
@param yAxisLabel
@throws ShanksException
194672
public void addTimeChart(String chartID, String xAxisLabel,
            String yAxisLabel) throws ShanksException {
        Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
                .getSimulation().getScenarioPortrayal();
        scenarioPortrayal.addTimeChart(chartID, xAxisLabel, yAxisLabel);
    }
970591
private void drawYValues(Graphics2D chartGraphics) {
    if (!showYAxisValues) {
      return;
    }

    chartGraphics.setColor(axisValuesColour);

    for (int i = 0; i < yValues.length; i++) {
      if (i % yAxisValuesFrequency != 0) {
        continue;
      }

      String yValueStr = yValues[i].toString();

      chartGraphics.setFont(axisValuesFont);
      FontMetrics metrics = chartGraphics.getFontMetrics();

      int valueWidth = metrics.stringWidth(yValueStr);

      if (yValuesHorizontal) {
        // Draw the value with whatever font is now set.
        int valueXPos = margin + yAxisLabelSize.height + (yAxisValuesWidthMax - valueWidth);
        int valueYPos = heatMapTL.y + (i * cellSize.height) + (cellSize.height / 2)
            + (yAxisValuesAscent / 2);

        chartGraphics.drawString(yValueStr, valueXPos, valueYPos);
      }
      else {
        int valueXPos = margin + yAxisLabelSize.height + yAxisValuesAscent;
        int valueYPos = heatMapTL.y + (i * cellSize.height) + (cellSize.height / 2)
            + (valueWidth / 2);

        // Create 270 degree rotated transform.
        AffineTransform transform = chartGraphics.getTransform();
        AffineTransform originalTransform = (AffineTransform) transform.clone();
        transform.rotate(Math.toRadians(270), valueXPos, valueYPos);
        chartGraphics.setTransform(transform);

        // Draw the string.
        chartGraphics.drawString(yValueStr, valueXPos, valueYPos);

        // Revert to original transform before rotation.
        chartGraphics.setTransform(originalTransform);
      }
    }
  }
49231
private void drawXLabel(Graphics2D chartGraphics) {
    if (xAxisLabel != null) {
      // Strings are drawn from the baseline position of the leftmost char.
      int yPosXAxisLabel = chartSize.height - (margin / 2) - xAxisLabelDescent;
      // TODO This will need to be updated if the y-axis values/label can be moved to the right.
      int xPosXAxisLabel = heatMapC.x - (xAxisLabelSize.width / 2);

      chartGraphics.setFont(axisLabelsFont);
      chartGraphics.setColor(axisLabelColour);
      chartGraphics.drawString(xAxisLabel, xPosXAxisLabel, yPosXAxisLabel);
    }
  }
638324
def add_timescale(self, timescale):
        
        if not isinstance(timescale, PlotTimeScale):
            self.log_exc(u"timescale must be an instance of PlotTimeScale", None, True, TypeError)
        self.timescale = timescale
        self.log(u"Added timescale")
1263086
public Axis addLabel(String label, double location) {
        if (labels == null) {
            labels = new HashMap<>();
        }

        labels.put(label, location);
        setSlice();
        initGridLines();
        initGridLabels();
        return this;
    }
388878
public Axis addLabel(String[] label, double[] location) {
        if (label.length != location.length) {
            throw new IllegalArgumentException("Label size and location size don't match.");
        }

        if (labels == null) {
            labels = new HashMap<>();
        }

        for (int i = 0; i < label.length; i++) {
            labels.put(label[i], location[i]);
        }

        setSlice();
        initGridLines();
        initGridLabels();
        return this;
    }
695243
function buildAxis(){
            xAxis = d3Axis.axisBottom(xScale);

            yAxis = d3Axis.axisLeft(yScale)
                .ticks(yTicks)
                .tickPadding(yTickPadding)
                .tickFormat(yAxisTickFormat);
        }
325783
def write_date_axis(params)  # :nodoc:
      x_axis    = params[:x_axis]
      y_axis    = params[:y_axis]
      axis_ids  = params[:axis_ids]

      return unless axis_ids && !axis_ids.empty?

      position  = @cat_axis_position

      # Overwrite the default axis position with a user supplied value.
      position = x_axis.position || position

      @writer.tag_elements('c:dateAx') do
        write_axis_id(axis_ids[0])
        # Write the c:scaling element.
        write_scaling_with_param(x_axis)

        write_delete(1) unless ptrue?(x_axis.visible)

        # Write the c:axPos element.
        write_axis_pos(position, y_axis.reverse)

        # Write the c:majorGridlines element.
        write_major_gridlines(x_axis.major_gridlines)

        # Write the c:minorGridlines element.
        write_minor_gridlines(x_axis.minor_gridlines)

        # Write the axis title elements.
        if x_axis.formula
          write_title_formula(x_axis, nil, nil, x_axis.layout)
        elsif x_axis.name
          write_title_rich(x_axis, nil, x_axis.layout)
        end
        # Write the c:numFmt element.
        write_number_format(x_axis)
        # Write the c:majorTickMark element.
        write_major_tick_mark(x_axis.major_tick_mark)

        # Write the c:tickLblPos element.
        write_tick_label_pos(x_axis.label_position)
        # Write the c:spPr element for the axis line.
        write_sp_pr(x_axis)
        # Write the font elements.
        write_axis_font(x_axis.num_font)
        # Write the c:crossAx element.
        write_cross_axis(axis_ids[1])

        if @show_crosses || ptrue?(x_axis.visible)
          write_crossing(y_axis.crossing)
        end

        # Write the c:auto element.
        write_auto(1)
        # Write the c:labelOffset element.
        write_label_offset(100)
        # Write the c:tickLblSkip element.
        write_tick_lbl_skip(x_axis.interval_unit)
        # Write the c:majorUnit element.
        write_c_major_unit(x_axis.major_unit)
        # Write the c:majorTimeUnit element.
        write_c_major_time_unit(x_axis.major_unit_type) if x_axis.major_unit
        # Write the c:minorUnit element.
        write_c_minor_unit(x_axis.minor_unit)
        # Write the c:minorTimeUnit element.
        write_c_minor_time_unit(x_axis.minor_unit_type) if x_axis.minor_unit
      end
    end
245771
function buildAxis() {
            let minor, major;

            if (xAxisFormat === 'custom' && typeof xAxisCustomFormat === 'string') {
                minor = {
                    tick: xTicks,
                    format: d3TimeFormat.timeFormat(xAxisCustomFormat)
                };
                major = null;
            } else {
                ({minor, major} = getTimeSeriesAxis(dataByDate, width, xAxisFormat, locale));

                xMonthAxis = d3Axis.axisBottom(xScale)
                    .ticks(major.tick)
                    .tickSize(0, 0)
                    .tickFormat(major.format);
            }

            xAxis = d3Axis.axisBottom(xScale)
                .ticks(minor.tick)
                .tickSize(10, 0)
                .tickPadding(tickPadding)
                .tickFormat(minor.format);

            yAxis = d3Axis.axisLeft(yScale)
                .ticks(yTicks)
                .tickSize([0])
                .tickPadding(tickPadding)
                .tickFormat(getFormattedValue);

            drawGridLines(minor.tick, yTicks);
        }
785792
function (options, isX, redraw, animation) {
		var key = isX ? 'xAxis' : 'yAxis',
			chartOptions = this.options,
			axis;

		/*jslint unused: false*/
		axis = new Axis(this, merge(options, {
			index: this[key].length,
			isX: isX
		}));
		/*jslint unused: true*/

		// Push the new axis options to the chart options
		chartOptions[key] = splat(chartOptions[key] || {});
		chartOptions[key].push(options);

		if (pick(redraw, true)) {
			this.redraw(animation);
		}
	}
1357219
private static JFreeChart createChart(
      String title, String xAxis, String yAxis1, XYDataset dataset1, String yAxis2,
      XYDataset dataset2
  ) {
    JFreeChart chart =
        ChartFactory.createXYLineChart(title, xAxis, yAxis1, dataset1, PlotOrientation.VERTICAL,
            true, true, false);

    final XYPlot plot = (XYPlot) chart.getPlot();

    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    final XYItemRenderer r = plot.getRenderer();

    int count = Math.min(dataset1.getSeriesCount(), dataset2.getSeriesCount());

    if (r instanceof XYLineAndShapeRenderer) {
      XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;

      renderer.setBaseStroke(LINE);
      renderer.setAutoPopulateSeriesPaint(false);
      renderer.setBaseShapesVisible(false);
      renderer.setBaseShapesFilled(false);
      renderer.setDrawSeriesLineAsPath(true);

      for (int i = 0; i < count; i++) {
        renderer.setSeriesPaint(i, COLORS.get(i % COLORS.size()));
      }
    }

    chart.setBackgroundPaint(Color.white);

    // chart two
    {
      final NumberAxis axis2 = new NumberAxis(yAxis2);
      axis2.setAutoRangeIncludesZero(false);
      plot.setRangeAxis(1, axis2);
      plot.setDataset(1, dataset2);
      plot.mapDatasetToRangeAxis(1, 1);

      final StandardXYItemRenderer renderer = new StandardXYItemRenderer();
      renderer.setAutoPopulateSeriesPaint(false);
      renderer.setAutoPopulateSeriesStroke(false);

      renderer.setBaseShapesVisible(false);
      renderer.setBaseShapesFilled(false);
      renderer.setDrawSeriesLineAsPath(true);
      renderer.setBaseStroke(DASHED);

      for (int i = 0; i < count; i++) {
        renderer.setSeriesPaint(i, COLORS.get(i % COLORS.size()));
      }

      plot.setRenderer(1, renderer);
    }

    return chart;
  }
909317
public static void plotCharts(List<Chart> charts){
		int numRows =1;
		int numCols =1;
		if(charts.size()>1){
			numRows = (int) Math.ceil(charts.size()/2.0);
			numCols = 2;
		}
		
	    final JFrame frame = new JFrame("");
	    frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        frame.getContentPane().setLayout(new GridLayout(numRows, numCols));
	    for (Chart chart : charts) {
	          if (chart != null) {
	            JPanel chartPanel = new XChartPanel(chart);
	            frame.add(chartPanel);
	          }
	          else {
	            JPanel chartPanel = new JPanel();
	            frame.getContentPane().add(chartPanel);
	          }

	        }
	    // Display the window.
        frame.pack();
        frame.setVisible(true);
	}
384071
private function get_axis($type, $index, $createifnotexists) {
        $isx = $type === 'x';
        if ($isx) {
            $axis = isset($this->xaxes[$index]) ? $this->xaxes[$index] : null;
        } else {
            $axis = isset($this->yaxes[$index]) ? $this->yaxes[$index] : null;
        }

        if ($axis === null) {
            if (!$createifnotexists) {
                throw new coding_exception('Unknown axis.');
            }

            $axis = new chart_axis();
            if ($isx) {
                $this->set_xaxis($axis, $index);
            } else {
                $this->set_yaxis($axis, $index);
            }
        }

        return $axis;
    }
401124
public BubbleSeries addSeries(
      String seriesName, double[] xData, double[] yData, double[] bubbleData) {

    // Sanity checks
    sanityCheck(seriesName, xData, yData, bubbleData);

    BubbleSeries series;
    if (xData != null) {

      // Sanity check
      if (xData.length != yData.length) {
        throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!");
      }

      series = new BubbleSeries(seriesName, xData, yData, bubbleData);
    } else { // generate xData
      series =
          new BubbleSeries(
              seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, bubbleData);
    }

    seriesMap.put(seriesName, series);

    return series;
  }
1313779
function(chart) {
            var tooltipRefresh = chart.tooltip.refresh,
                decorateTooltip = (this.processedData.xAxisType === 'time') ?
                        this.addTimeTooltipClasses.bind(this) : this.addTooltipClasses.bind(this);

            this.addDataClasses(chart);
            this.addAxisClasses(chart);
            if(chart.options.legend.enabled) {
                this.addLegendClasses(chart);
            }
            chart.tooltip.refresh = function(point) {
                tooltipRefresh(point);
                decorateTooltip(chart);
            }.bind(this);
        }
134034
def _set_axis(self, axis, labels, fastpath=False):
        

        if not fastpath:
            labels = ensure_index(labels)

        is_all_dates = labels.is_all_dates
        if is_all_dates:
            if not isinstance(labels,
                              (DatetimeIndex, PeriodIndex, TimedeltaIndex)):
                try:
                    labels = DatetimeIndex(labels)
                    # need to set here because we changed the index
                    if fastpath:
                        self._data.set_axis(axis, labels)
                except (tslibs.OutOfBoundsDatetime, ValueError):
                    # labels may exceeds datetime bounds,
                    # or not be a DatetimeIndex
                    pass

        self._set_subtyp(is_all_dates)

        object.__setattr__(self, '_index', labels)
        if not fastpath:
            self._data.set_axis(axis, labels)
1242641
protected void xAxis(Graphics g) {
        g.setColor(Color.BLACK);

        // x-axis line
        g.drawLine(X_OFFSET_LEFT, calcY(0), width + X_OFFSET_LEFT, calcY(0));

        drawXLabels(g);
    }