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;
 }
 public boolean startSeries(
     final WDataSeries series, double groupWidth, int numBarGroups, int currentBarGroup) {
   this.marker_.assign(new WPainterPath());
   if (series.getMarker() != MarkerType.NoMarker) {
     this.chart_.drawMarker(series, this.marker_);
     this.painter_.save();
     this.needRestore_ = true;
   } else {
     this.needRestore_ = false;
   }
   return true;
 }
 private void finishPathFragment(final WDataSeries series) {
   if (this.pathFragment_.getSegments().isEmpty()) {
     return;
   }
   this.painter_.save();
   this.painter_.setWorldTransform(
       new WTransform(this.currentScale_, 0, 0, this.currentScale_, 0, 0));
   WTransform currentTransform =
       new WTransform(1.0 / this.currentScale_, 0, 0, 1.0 / this.currentScale_, 0, 0)
           .multiply(this.chart_.getZoomRangeTransform());
   this.painter_.setPen(new WPen(PenStyle.NoPen));
   this.painter_.setBrush(new WBrush(BrushStyle.NoBrush));
   this.painter_.setShadow(series.getShadow());
   if (series.getMarker() != MarkerType.CrossMarker
       && series.getMarker() != MarkerType.XCrossMarker
       && series.getMarker() != MarkerType.AsteriskMarker
       && series.getMarker() != MarkerType.StarMarker) {
     this.painter_.setBrush(this.currentBrush_);
     if (!series.getShadow().isNone()) {
       this.painter_.drawStencilAlongPath(
           this.marker_, currentTransform.map(this.pathFragment_), false);
     }
     this.painter_.setShadow(new WShadow());
   }
   this.painter_.setPen(this.currentPen_);
   if (!series.getShadow().isNone()) {
     this.painter_.setBrush(new WBrush(BrushStyle.NoBrush));
   }
   this.painter_.drawStencilAlongPath(
       this.marker_, currentTransform.map(this.pathFragment_), false);
   this.painter_.restore();
   this.pathFragment_.assign(new WPainterPath());
 }
 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;
         }
       }
     }
   }
 }