code: public CategorySeries updateCategorySeries(
        String seriesName,
        List<?> newXData,
        List<? extends Number> newYData,
        List<? extends Number> newErrorBarData) {
  
      Map<String, CategorySeries> seriesMap = getSeriesMap();
      CategorySeries series = seriesMap.get(seriesName);
      if (series == null) {
        throw new IllegalArgumentException("Series name >" + seriesName + "< not found!!!");
      }
      if (newXData == null) {
        // generate X-Data
        List<Integer> generatedXData = new ArrayList<Integer>();
        for (int i = 1; i <= newYData.size(); i++) {
          generatedXData.add(i);
        }
        series.replaceData(generatedXData, newYData, newErrorBarData);
      } else {
        series.replaceData(newXData, newYData, newErrorBarData);
      }
  
      return series;
    }
docs: Update a series by updating the X-Axis, Y-Axis and error bar data
  
  @param seriesName
  @param newXData - set null to be automatically generated as a list of increasing Integers
  starting from 1 and ending at the size of the new Y-Axis data list.
  @param newYData
  @param newErrorBarData - set null if there are no error bars
  @return