コード例 #1
0
 private double calculateMarkerScale(
     final WDataSeries series, int xRow, int xColumn, int yRow, int yColumn, double markerSize) {
   Double scale = null;
   double dScale = 1;
   if (yRow >= 0 && yColumn >= 0) {
     scale = series.getModel().getMarkerScaleFactor(yRow, yColumn);
   }
   if (!(scale != null) && xRow >= 0 && xColumn >= 0) {
     scale = series.getModel().getMarkerScaleFactor(xRow, xColumn);
   }
   if (scale != null) {
     dScale = scale;
   }
   dScale = markerSize / 6 * dScale;
   return dScale;
 }
コード例 #2
0
 public void newValue(
     final WDataSeries series,
     double x,
     double y,
     double stackY,
     int xRow,
     int xColumn,
     int yRow,
     int yColumn) {
   if (!Double.isNaN(x) && !Double.isNaN(y)) {
     WPointF p =
         this.chart_.map(
             x, y, series.getAxis(), this.getCurrentXSegment(), this.getCurrentYSegment());
     if (!this.marker_.isEmpty()) {
       WPen pen = series.getMarkerPen().clone();
       SeriesIterator.setPenColor(
           pen, series, xRow, xColumn, yRow, yColumn, ItemDataRole.MarkerPenColorRole);
       if (this.chart_.isSeriesSelectionEnabled()
           && this.chart_.getSelectedSeries() != null
           && this.chart_.getSelectedSeries() != series) {
         pen.setColor(WCartesianChart.lightenColor(pen.getColor()));
       }
       WBrush brush = series.getMarkerBrush().clone();
       SeriesIterator.setBrushColor(
           brush, series, xRow, xColumn, yRow, yColumn, ItemDataRole.MarkerBrushColorRole);
       double scale =
           this.calculateMarkerScale(series, xRow, xColumn, yRow, yColumn, series.getMarkerSize());
       if (this.chart_.isSeriesSelectionEnabled()
           && this.chart_.getSelectedSeries() != null
           && this.chart_.getSelectedSeries() != series) {
         brush.setColor(WCartesianChart.lightenColor(brush.getColor()));
       }
       if (!(this.series_ != null)
           || !brush.equals(this.currentBrush_)
           || !pen.equals(this.currentPen_)
           || scale != this.currentScale_) {
         if (this.series_ != null) {
           this.finishPathFragment(this.series_);
         }
         this.series_ = series;
         this.currentBrush_ = brush;
         this.currentPen_ = pen;
         this.currentScale_ = scale;
       }
       this.pathFragment_.moveTo(this.hv(p));
     }
     if (series.getType() != SeriesType.BarSeries) {
       WString toolTip = series.getModel().getToolTip(yRow, yColumn);
       if (!(toolTip.length() == 0)) {
         if (!(!EnumUtils.mask(
                     series.getModel().flags(yRow, yColumn), ItemFlag.ItemHasDeferredTooltip)
                 .isEmpty()
             || !EnumUtils.mask(series.getModel().flags(yRow, yColumn), ItemFlag.ItemIsXHTMLText)
                 .isEmpty())) {
           WTransform t = this.painter_.getWorldTransform();
           p = t.map(this.hv(p));
           WCircleArea circleArea = new WCircleArea();
           circleArea.setCenter(new WPointF(p.getX(), p.getY()));
           circleArea.setRadius(5);
           circleArea.setToolTip(toolTip);
           this.chart_.addDataPointArea(series, xRow, xColumn, circleArea);
         } else {
           this.chart_.hasDeferredToolTips_ = true;
         }
       }
     }
   }
 }