Add a series for a OHLC type chart using Lists

@param seriesName
@param openData the open data
@param highData the high data
@param lowData the low data
@param closeData the close data
@return A Series object that you can set properties on
435261
public OHLCSeries addSeries(
      String seriesName,
      List<? extends Number> openData,
      List<? extends Number> highData,
      List<? extends Number> lowData,
      List<? extends Number> closeData) {

    return addSeries(seriesName, null, openData, highData, lowData, closeData);
  }
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;
  }
397831
public void setDataType(Series.DataType dataType) {

    if (dataType != null && this.dataType != null && this.dataType != dataType) {
      throw new IllegalArgumentException(
          "Different Axes (e.g. Date, Number, String) cannot be mixed on the same chart!!");
    }
    this.dataType = dataType;
  }
24180
@Override
	public LegendItem getLegendItem(int datasetIndex, int series) {
		XYPlot plot = getPlot();
		if (plot == null) {
			return null;
		}

		XYDataset dataset = plot.getDataset(datasetIndex);
		if (dataset == null) {
			return null;
		}

		//jfreechart diff: set the line paint with the implementation of abstract getLinePaint
		Paint linePaint = getLinePaint(series);

		String label = getLegendItemLabelGenerator().generateLabel(dataset, 
				series);
		String description = label;
		String toolTipText = null;
		if (getLegendItemToolTipGenerator() != null) {
			toolTipText = getLegendItemToolTipGenerator().generateLabel(
					dataset, series);
		}
		String urlText = null;
		if (getLegendItemURLGenerator() != null) {
			urlText = getLegendItemURLGenerator().generateLabel(dataset, 
					series);
		}
		boolean shapeIsVisible = getItemShapeVisible(series, 0);
		Shape shape = lookupLegendShape(series);
		boolean shapeIsFilled = getItemShapeFilled(series, 0);
		Paint fillPaint = (this.getUseFillPaint() ? lookupSeriesFillPaint(series) 
				: linePaint);
		boolean shapeOutlineVisible = this.getDrawOutlines();
		Paint outlinePaint = (this.getUseOutlinePaint() ? lookupSeriesOutlinePaint(
				series) : linePaint);
		Stroke outlineStroke = lookupSeriesOutlineStroke(series);
		boolean lineVisible = getItemLineVisible(series, 0);
		Stroke lineStroke = lookupSeriesStroke(series);

		LegendItem result = new LegendItem(label, description, toolTipText, urlText, shapeIsVisible, shape,
				shapeIsFilled, fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible,
				this.getLegendLine(), lineStroke, linePaint);
		result.setLabelFont(lookupLegendTextFont(series));
		Paint labelPaint = lookupLegendTextPaint(series);
		if (labelPaint != null) {
			result.setLabelPaint(labelPaint);
		}
		result.setSeriesKey(dataset.getSeriesKey(series));
		result.setSeriesIndex(series);
		result.setDataset(dataset);
		result.setDatasetIndex(datasetIndex);
		return result;
	}
1204105
function (series, options) {
		var point = this,
			counters = series.chart.counters,
			defaultColors;
		point.series = series;
		point.applyOptions(options);
		point.pointAttr = {};

		if (series.options.colorByPoint) {
			defaultColors = series.chart.options.colors;
			if (!point.options) {
				point.options = {};
			}
			point.color = point.options.color = point.color || defaultColors[counters.color++];

			// loop back to zero
			counters.wrapColor(defaultColors.length);
		}

		series.chart.pointCount++;
		return point;
	}
423572
public Result<Void> writeDataPoints(Series series, List<DataPoint> data) {
    checkNotNull(series);
    checkNotNull(data);

    URI uri = null;
    try {
      URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/data/", API_VERSION, urlencode(series.getKey())));
      uri = builder.build();
    } catch (URISyntaxException e) {
      String message = String.format("Could not build URI with inputs: key: %s", series.getKey());
      throw new IllegalArgumentException(message, e);
    }

    Result<Void> result = null;
    String body = null;
    try{
      body = Json.dumps(data);
    } catch (JsonProcessingException e) {
      String message = "Error serializing the body of the request. More detail: " + e.getMessage();
      result = new Result<Void>(null, GENERIC_ERROR_CODE, message);
      return result;
    }

    HttpRequest request = buildRequest(uri.toString(), HttpMethod.POST, body);
    result = execute(request, Void.class);
    return result;
  }
1026764
@Transactional
    @Override
    public void importData(ExternalStylesheetDescriptor data) {
        final String stylesheetName = data.getName();
        final String uri = data.getUri();

        IStylesheetDescriptor stylesheetDescriptor =
                this.stylesheetDescriptorDao.getStylesheetDescriptorByName(stylesheetName);
        if (stylesheetDescriptor == null) {
            stylesheetDescriptor =
                    this.stylesheetDescriptorDao.createStylesheetDescriptor(stylesheetName, uri);
        } else {
            stylesheetDescriptor.setStylesheetResource(uri);
        }

        stylesheetDescriptor.setUrlNodeSyntaxHelperName(data.getUrlSyntaxHelper());
        stylesheetDescriptor.setDescription(data.getDescription());

        final List<ExternalOutputPropertyDescriptor> extOutputProperties =
                data.getOutputProperties();
        final List<IOutputPropertyDescriptor> outputPropertyDescriptors =
                new ArrayList<IOutputPropertyDescriptor>(extOutputProperties.size());
        for (final ExternalOutputPropertyDescriptor extOutputProperty : extOutputProperties) {
            final String name = extOutputProperty.getName();
            final Scope scope = Scope.valueOf(extOutputProperty.getScope().name());
            final OutputPropertyDescriptorImpl outputPropertyDescriptor =
                    new OutputPropertyDescriptorImpl(name, scope);
            outputPropertyDescriptor.setDefaultValue(extOutputProperty.getDefaultValue());
            outputPropertyDescriptor.setDescription(extOutputProperty.getDescription());

            outputPropertyDescriptors.add(outputPropertyDescriptor);
        }
        stylesheetDescriptor.setOutputPropertyDescriptors(outputPropertyDescriptors);

        final List<ExternalStylesheetParameterDescriptor> extStylesheetParameters =
                data.getStylesheetParameters();
        final List<IStylesheetParameterDescriptor> stylesheetParameterDescriptors =
                new ArrayList<IStylesheetParameterDescriptor>(extOutputProperties.size());
        for (final ExternalStylesheetParameterDescriptor extStylesheetParameter :
                extStylesheetParameters) {
            final String name = extStylesheetParameter.getName();
            final Scope scope = Scope.valueOf(extStylesheetParameter.getScope().name());
            final StylesheetParameterDescriptorImpl stylesheetParameterDescriptor =
                    new StylesheetParameterDescriptorImpl(name, scope);
            stylesheetParameterDescriptor.setDefaultValue(extStylesheetParameter.getDefaultValue());
            stylesheetParameterDescriptor.setDescription(extStylesheetParameter.getDescription());

            stylesheetParameterDescriptors.add(stylesheetParameterDescriptor);
        }
        stylesheetDescriptor.setStylesheetParameterDescriptors(stylesheetParameterDescriptors);

        final List<ExternalLayoutAttributeDescriptor> extLayoutAttributes =
                data.getLayoutAttributes();
        final List<ILayoutAttributeDescriptor> layoutAttributeDescriptors =
                new ArrayList<ILayoutAttributeDescriptor>(extOutputProperties.size());
        for (final ExternalLayoutAttributeDescriptor extLayoutAttribute : extLayoutAttributes) {
            final String name = extLayoutAttribute.getName();
            final Scope scope = Scope.valueOf(extLayoutAttribute.getScope().name());
            final LayoutAttributeDescriptorImpl layoutAttributeDescriptor =
                    new LayoutAttributeDescriptorImpl(name, scope);
            layoutAttributeDescriptor.setDefaultValue(extLayoutAttribute.getDefaultValue());
            layoutAttributeDescriptor.setDescription(extLayoutAttribute.getDescription());
            layoutAttributeDescriptor.setTargetElementNames(
                    new LinkedHashSet<String>(extLayoutAttribute.getTargetElements()));

            layoutAttributeDescriptors.add(layoutAttributeDescriptor);
        }
        stylesheetDescriptor.setLayoutAttributeDescriptors(layoutAttributeDescriptors);

        this.stylesheetDescriptorDao.updateStylesheetDescriptor(stylesheetDescriptor);
    }
614453
public CategorySeries addSeries(String seriesName, double[] xData, double[] yData) {

    return addSeries(seriesName, xData, yData, null);
  }
735752
public void addSeries( String seriesName, double[] x, double[] y ) {
        XYSeries series = new XYSeries(seriesName);
        for( int i = 0; i < x.length; i++ ) {
            series.add(x[i], y[i]);
        }
        dataset.addSeries(series);
    }
871679
@SuppressWarnings("deprecation")
	private JFreeChart createChart(CategoryDataset dataset) {

//		String s = name;
		String s = null;
		String tit = null;
		String ax = null;
//		if (first)
//			tit = title + " (EST)";
//		else if (last)
//			ax = "Time";

		tit = this.name;
		
        chart = ChartFactory.createStackedBarChart(
            tit,  // chart title
            s,                  // domain axis label
            ax,                     // range axis label
            dataset,                     // data
            PlotOrientation.HORIZONTAL,    // the plot orientation
            false,                        // legend
            false,                       // tooltips
            false                        // urls
        );
        CategoryPlot plot = chart.getCategoryPlot();

        chart.getTitle().setHorizontalAlignment(HorizontalAlignment.LEFT);
        plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);

        //plot.getCategories();
        //CategoryItemRenderer renderer = plot.getRenderer();
        StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer();
        renderer.setItemLabelsVisible(true);
        renderer.setItemLabelGenerator(new LabelGenerator(showlabels));
        ItemLabelPosition pos = new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.TOP_RIGHT);
    	renderer.setPositiveItemLabelPositionFallback(pos);
        for(int i = 0; i < dataset.getRowCount(); i++) {
        	renderer.setSeriesPositiveItemLabelPosition(i, pos);
        }
        
        /*
        if (values.elementAt(0) instanceof ResourceLevel) {
        	renderer.setItemLabelGenerator( new PlotBoxTL.LabelGenerator(true));
        }
        else
        	renderer.setItemLabelGenerator( new PlotBoxTL.LabelGenerator(false));
        */
        renderer.setToolTipGenerator(new PlotBoxTooltip());
        plot.setRenderer(renderer);
       // renderer.getSeriesStroke(0).
        plot.setForegroundAlpha(0.8f);
                        
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
        rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
        rangeAxis.setLowerMargin(2.0);
        rangeAxis.setUpperMargin(2.0);
        
        //long origin = stl.getSerializableSimpleTimeline().getEarliestStartTime();
        //long horizon = stl.getSerializableSimpleTimeline().getLatestEndTime();
        long origin = stl.getPulses()[0].longValue();
        NumberFormat nf = new DecimalFormat();
        rangeAxis.setNumberFormatOverride ( nf ); 
        if (this.range != null) rangeAxis.setRange(range);
        //rangeAxis.setRange((new Double(origin)).doubleValue(), (new Double(horizon)).doubleValue());
   
        ///// 0 should be replaced by the start of the horizon
        renderer.setBase(origin);
        
        //renderer.setBase();
        
        

        for (int i = 0; i < durations.length; i++) {
	        if (stl.isInconsistent(values[i]))
	        	renderer.setSeriesPaint(i, new Color(198, 30, 69));
	        else if (stl.isCritical(values[i]))
	        		renderer.setSeriesPaint(i, new Color(238,234,111));
	        else if (stl.isUndetermined(values[i]))
        		renderer.setSeriesPaint(i, new Color(255,255,255));
        	else renderer.setSeriesPaint(i, new Color(111,180,238));
        	renderer.setSeriesOutlinePaint(i, Color.black);
		}
        
        renderer.setBaseSeriesVisibleInLegend(false, false);
        
        renderer.setSeriesStroke(0, new BasicStroke(40f));
        
        return chart;
	}
1029508
def _add_series_or_dataframe_operations(cls):
        

        from pandas.core import window as rwindow

        @Appender(rwindow.rolling.__doc__)
        def rolling(self, window, min_periods=None, center=False,
                    win_type=None, on=None, axis=0, closed=None):
            axis = self._get_axis_number(axis)
            return rwindow.rolling(self, window=window,
                                   min_periods=min_periods,
                                   center=center, win_type=win_type,
                                   on=on, axis=axis, closed=closed)

        cls.rolling = rolling

        @Appender(rwindow.expanding.__doc__)
        def expanding(self, min_periods=1, center=False, axis=0):
            axis = self._get_axis_number(axis)
            return rwindow.expanding(self, min_periods=min_periods,
                                     center=center, axis=axis)

        cls.expanding = expanding

        @Appender(rwindow.ewm.__doc__)
        def ewm(self, com=None, span=None, halflife=None, alpha=None,
                min_periods=0, adjust=True, ignore_na=False,
                axis=0):
            axis = self._get_axis_number(axis)
            return rwindow.ewm(self, com=com, span=span, halflife=halflife,
                               alpha=alpha, min_periods=min_periods,
                               adjust=adjust, ignore_na=ignore_na, axis=axis)

        cls.ewm = ewm
1020660
private static function _chartDataSeriesValuesMultiLevel($seriesValueSet,$dataType='n') {
		$seriesVal = array();
		$formatCode = '';
		$pointCount = 0;

		foreach($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
			foreach($seriesLevel as $seriesValueIdx => $seriesValue) {
				switch ($seriesValueIdx) {
					case 'ptCount':
						$pointCount = self::_getAttribute($seriesValue, 'val', 'integer');
						break;
					case 'formatCode':
						$formatCode = (string) $seriesValue;
						break;
					case 'pt':
						$pointVal = self::_getAttribute($seriesValue, 'idx', 'integer');
						if ($dataType == 's') {
							$seriesVal[$pointVal][] = (string) $seriesValue->v;
						} else {
							$seriesVal[$pointVal][] = (float) $seriesValue->v;
						}
						break;
				}
			}
		}

		return array( 'formatCode'	=> $formatCode,
					  'pointCount'	=> $pointCount,
					  'dataValues'	=> $seriesVal
					);
	}
467086
public static PlotCanvas plot(String id, double[] data) {
        double[] lowerBound = {0, Math.min(data)};
        double[] upperBound = {data.length, Math.max(data)};
        PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound);

        BarPlot plot = new BarPlot(data);
        plot.setID(id);
        canvas.add(plot);

        canvas.getAxis(0).setGridVisible(false);
        canvas.getAxis(0).setLabelVisible(false);

        return canvas;
    }
196684
public void setWrappedData(Object data) {
        if (data == null) {
            inner = null;
            arrayFromInner = null;
            setRowIndex(-1);
        } else {
            inner = (Collection<E>) data;            
            arrayFromInner = (E[]) new Object[inner.size()];
            inner.toArray(arrayFromInner);
            setRowIndex(0);
        }
    }
736330
function () {
		
		var data = this.data,
			length = data.length,
			i,
			originalDataLabels = [],
			seriesProto = Series.prototype,
			dataLabelOptions = this.options.dataLabels,
			align = dataLabelOptions.align,
			point,
			inverted = this.chart.inverted;
			
		if (dataLabelOptions.enabled || this._hasPointLabels) {
			
			// Step 1: set preliminary values for plotY and dataLabel and draw the upper labels
			i = length;
			while (i--) {
				point = data[i];
				
				// Set preliminary values
				point.y = point.high;
				point._plotY = point.plotY;
				point.plotY = point.plotHigh;
				
				// Store original data labels and set preliminary label objects to be picked up 
				// in the uber method
				originalDataLabels[i] = point.dataLabel;
				point.dataLabel = point.dataLabelUpper;
				
				// Set the default offset
				point.below = false;
				if (inverted) {
					if (!align) {
						dataLabelOptions.align = 'left';
					}
					dataLabelOptions.x = dataLabelOptions.xHigh;								
				} else {
					dataLabelOptions.y = dataLabelOptions.yHigh;
				}
			}
			
			if (seriesProto.drawDataLabels) {
				seriesProto.drawDataLabels.apply(this, arguments); // #1209
			}
			
			// Step 2: reorganize and handle data labels for the lower values
			i = length;
			while (i--) {
				point = data[i];
				
				// Move the generated labels from step 1, and reassign the original data labels
				point.dataLabelUpper = point.dataLabel;
				point.dataLabel = originalDataLabels[i];
				
				// Reset values
				point.y = point.low;
				point.plotY = point._plotY;
				
				// Set the default offset
				point.below = true;
				if (inverted) {
					if (!align) {
						dataLabelOptions.align = 'right';
					}
					dataLabelOptions.x = dataLabelOptions.xLow;
				} else {
					dataLabelOptions.y = dataLabelOptions.yLow;
				}
			}
			if (seriesProto.drawDataLabels) {
				seriesProto.drawDataLabels.apply(this, arguments);
			}
		}

		dataLabelOptions.align = align;
	
	}
526898
function () {
		
		var columns = this.columns,
			xColumns = [],
			type,
			options = this.options,
			series,
			data,
			i,
			j,
			r,
			seriesIndex,
			chartOptions,
			allSeriesBuilders = [],
			builder,
			freeIndexes,
			typeCol,
			index;

		xColumns.length = columns.length;
		if (options.complete || options.afterComplete) {

			// Get the names and shift the top row
			for (i = 0; i < columns.length; i++) {
				if (this.firstRowAsNames) {
					columns[i].name = columns[i].shift();
				}
			}
			
			// Use the next columns for series
			series = [];
			freeIndexes = this.getFreeIndexes(columns.length, this.valueCount.seriesBuilders);

			// Populate defined series
			for (seriesIndex = 0; seriesIndex < this.valueCount.seriesBuilders.length; seriesIndex++) {
				builder = this.valueCount.seriesBuilders[seriesIndex];

				// If the builder can be populated with remaining columns, then add it to allBuilders
				if (builder.populateColumns(freeIndexes)) {
					allSeriesBuilders.push(builder);
				}
			}

			// Populate dynamic series
			while (freeIndexes.length > 0) {
				builder = new SeriesBuilder();
				builder.addColumnReader(0, 'x');
				
				// Mark index as used (not free)
				index = inArray(0, freeIndexes);
				if (index !== -1) {
					freeIndexes.splice(index, 1);
				}

				for (i = 0; i < this.valueCount.global; i++) {
					// Create and add a column reader for the next free column index
					builder.addColumnReader(undefined, this.valueCount.globalPointArrayMap[i]);
				}

				// If the builder can be populated with remaining columns, then add it to allBuilders
				if (builder.populateColumns(freeIndexes)) {
					allSeriesBuilders.push(builder);
				}
			}

			// Get the data-type from the first series x column
			if (allSeriesBuilders.length > 0 && allSeriesBuilders[0].readers.length > 0) {
				typeCol = columns[allSeriesBuilders[0].readers[0].columnIndex];
				if (typeCol !== undefined) {
					if (typeCol.isDatetime) {
						type = 'datetime';
					} else if (!typeCol.isNumeric) {
						type = 'category';
					}
				}
			}
			// Axis type is category, then the "x" column should be called "name"
			if (type === 'category') {
				for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) {
					builder = allSeriesBuilders[seriesIndex];
					for (r = 0; r < builder.readers.length; r++) {
						if (builder.readers[r].configName === 'x') {
							builder.readers[r].configName = 'name';
						}
					}
				}
			}

			// Read data for all builders
			for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) {
				builder = allSeriesBuilders[seriesIndex];

				// Iterate down the cells of each column and add data to the series
				data = [];
				for (j = 0; j < columns[0].length; j++) { // TODO: which column's length should we use here
					data[j] = builder.read(columns, j);
				}

				// Add the series
				series[seriesIndex] = {
					data: data
				};
				if (builder.name) {
					series[seriesIndex].name = builder.name;
				}
				if (type === 'category') {
					series[seriesIndex].turboThreshold = 0;
				}
			}



			// Do the callback
			chartOptions = {
				series: series
			};
			if (type) {
				chartOptions.xAxis = {
					type: type
				};
			}
			
			if (options.complete) {
				options.complete(chartOptions);
			}

			// The afterComplete hook is used internally to avoid conflict with the externally
			// available complete option.
			if (options.afterComplete) {
				options.afterComplete(chartOptions);
			}
		}
	}
16517
public AbstractChart<T, S> addSerie(Serie serie) {
		Collection<Serie> series = getSeries();
		if (series == null) {
			series = new ArrayList<Serie>();
		}
		series.add(serie);
		return this;
	}