fixed inverted values drawing for line chart
authorVictor Kirhenshtein <victor@netxms.org>
Fri, 10 Jun 2016 08:53:30 +0000 (11:53 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Fri, 10 Jun 2016 08:53:30 +0000 (11:53 +0300)
src/java/netxms-eclipse/swtchart/src/org/swtchart/internal/series/LineSeries.java
webui/webapp/swtchart/src/org/swtchart/internal/series/LineSeries.java

index 9289ae1..be921e7 100644 (file)
@@ -544,11 +544,11 @@ public class LineSeries extends Series implements ILineSeries
                        double yUpper = yAxis.getRange().upper;
 
                        int prevX = xAxis.getPixelCoordinate(xseries[0], xLower, xUpper);
-                       int prevY = yAxis.getPixelCoordinate(yseries[0], yLower, yUpper);
+                       int prevY = yAxis.getPixelCoordinate(inverted ? -yseries[0] : yseries[0], yLower, yUpper);
                        for(int i = 0; i < xseries.length - 1; i++)
                        {
                                int x = xAxis.getPixelCoordinate(xseries[i + 1], xLower, xUpper);
-                               int y = yAxis.getPixelCoordinate(yseries[i + 1], yLower, yUpper);
+                               int y = yAxis.getPixelCoordinate(inverted ? -yseries[i + 1] : yseries[i + 1], yLower, yUpper);
                                if (isHorizontal)
                                {
                                        gc.drawLine(prevX, prevY, x, y);
index 9bc194d..7508451 100644 (file)
@@ -543,11 +543,11 @@ public class LineSeries extends Series implements ILineSeries
                        double yUpper = yAxis.getRange().upper;
 
                        int prevX = xAxis.getPixelCoordinate(xseries[0], xLower, xUpper);
-                       int prevY = yAxis.getPixelCoordinate(yseries[0], yLower, yUpper);
+                       int prevY = yAxis.getPixelCoordinate(inverted ? -yseries[0] : yseries[0], yLower, yUpper);
                        for(int i = 0; i < xseries.length - 1; i++)
                        {
                                int x = xAxis.getPixelCoordinate(xseries[i + 1], xLower, xUpper);
-                               int y = yAxis.getPixelCoordinate(yseries[i + 1], yLower, yUpper);
+                               int y = yAxis.getPixelCoordinate(inverted ? -yseries[i + 1] : yseries[i + 1], yLower, yUpper);
                                if (isHorizontal)
                                {
                                        gc.drawLine(prevX, prevY, x, y);