From 7ccb4e87d721a0ddcb9df0ce8b0f8877f5598dd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pior?= Date: Mon, 23 Jul 2018 23:09:45 +0200 Subject: [PATCH] #7625 fix python NanoPlot problems (#7663) * #7625 handle single point correctly * #7625 fixed num to string conversion for nanoplot elements coordinates * #7625 fix python NanoPlot problems * #7625 fix * #7625 CR fix --- beakerx/beakerx/plot/chart.py | 10 +++++++--- js/notebook/src/plot/plotUtils.js | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/beakerx/beakerx/plot/chart.py b/beakerx/beakerx/plot/chart.py index 354a8d73cf..0ef69bdbee 100644 --- a/beakerx/beakerx/plot/chart.py +++ b/beakerx/beakerx/plot/chart.py @@ -442,11 +442,15 @@ def __init__(self, **kwargs): def add(self, item): super(NanoPlot, self).add(item) - converted = [] for l in self.chart.graphics_list: + convertedx = [] + convertedy = [] for x in l.x: - converted.append(str(x)) - l.x = converted + convertedx.append(str(x)) + l.x = convertedx + for y in l.y: + convertedy.append(str(y)) + l.y = convertedy self.model = self.chart.transform() return self diff --git a/js/notebook/src/plot/plotUtils.js b/js/notebook/src/plot/plotUtils.js index 6ca548b025..a952ee3f93 100644 --- a/js/notebook/src/plot/plotUtils.js +++ b/js/notebook/src/plot/plotUtils.js @@ -218,10 +218,12 @@ define([ var self = this; var increaseRange = function(value) { - return self.plus(value, self.div((value || 1), 10)); + var v = self.eq(value, 0) ? 1 : value || 1; + return self.plus(value, self.div(v, 10)); }; var decreaseRange = function(value){ - return self.minus(value, self.div((value || 1), 10)); + var v = self.eq(value, 0) ? 1 : value || 1; + return self.minus(value, self.div(v, 10)); }; if (this.eq(datarange.xl, datarange.xr)) {