예제 #1
0
 /**
  * Convert values to match the Highcharts demand when using json
  *
  * @param fieldTypeEnum
  * @param value
  * @return Object
  */
 public Object convertValue(AttributeType fieldTypeEnum, Object value) {
   if (AttributeType.DATE_TIME.equals(fieldTypeEnum)) {
     return (convertDateTimeToMilliseconds((Date) value));
   } else if (AttributeType.DATE.equals(fieldTypeEnum)) {
     return (convertDateToMilliseconds((Date) value));
   } else {
     // Highcharts uses the string value of the x axis as the name of the point
     return value;
   }
 }
예제 #2
0
  /**
   * Parse the xYDataSerie to a Series object computable with the Highcharts xy series standard.
   *
   * @param xYDataSerie
   * @return Series
   */
  public Series parsexYDataSerieToSeries(XYDataSerie xYDataSerie) {
    Series series = new Series();
    series.setName(xYDataSerie.getName());
    series.setType(SeriesType.getSeriesType(xYDataSerie.getType()));
    series.setData(
        parseXYDataToList(
            xYDataSerie.getData(),
            xYDataSerie.getAttributeXFieldTypeEnum(),
            xYDataSerie.getAttributeYFieldTypeEnum()));

    if (MolgenisSerieType.SCATTER.equals(xYDataSerie.getType())
        && (AttributeType.DATE.equals(xYDataSerie.getAttributeXFieldTypeEnum())
            || AttributeType.DATE_TIME.equals(xYDataSerie.getAttributeXFieldTypeEnum()))) {
      series.setLineWidth(0);
      series.setMarker(new Marker(true, 4));
      series.setType(SeriesType.getSeriesType(MolgenisSerieType.LINE));
    }
    return series;
  }