From 22b2989c3a864eb4c6a3dbeeeb5df7c992bb8bce Mon Sep 17 00:00:00 2001 From: Marvin-HH <152961997+Marvin-HH@users.noreply.github.com> Date: Wed, 15 Jul 2026 09:03:29 +0200 Subject: [PATCH] plotdata.py: updated limiting of string values Change limitation on strings from 1000 strings in total to 100 unique strings. This allows plotting of data sets with text data (e.g. log files) --- pydatview/plotdata.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pydatview/plotdata.py b/pydatview/plotdata.py index 272c120..368679f 100644 --- a/pydatview/plotdata.py +++ b/pydatview/plotdata.py @@ -1,5 +1,6 @@ import os import numpy as np +import pandas from pydatview.common import no_unit, unit, inverse_unit, splitunit, has_chinese_char from pydatview.common import isString, isDate, getDt from pydatview.common import unique, pretty_num, pretty_time, pretty_date @@ -118,12 +119,12 @@ def _post_init(PD, pipeline=None): # --- Store stats - n=len(PD.y) - if n>1000: + n=len(pandas.unique(PD.y)) + if n>100: if (PD.xIsString): - raise Exception('Error: x values contain more than 1000 string. This is not suitable for plotting.\n\nPlease select another column for table: {}\nProblematic column: {}\n'.format(PD.st,PD.sx)) + raise Exception('Error: x values contain more than 100 unique string. This is not suitable for plotting.\n\nPlease select another column for table: {}\nProblematic column: {}\n'.format(PD.st,PD.sx)) if (PD.yIsString): - raise Exception('Error: y values contain more than 1000 string. This is not suitable for plotting.\n\nPlease select another column for table: {}\nProblematic column: {}\n'.format(PD.st,PD.sy)) + raise Exception('Error: y values contain more than 100 unique string. This is not suitable for plotting.\n\nPlease select another column for table: {}\nProblematic column: {}\n'.format(PD.st,PD.sy)) PD.needChineseFont = has_chinese_char(PD.sy) or has_chinese_char(PD.sx) # Stats of the raw data (computed once and for all, since it can be expensive for large dataset