perspective icon indicating copy to clipboard operation
perspective copied to clipboard

`split_by` color:value mapping for charts should not change due to `update()`

Open texodus opened this issue 2 years ago • 3 comments

Bug Report

Steps to Reproduce:

There is an excellent repo in #1487, copy/pasted below. Note this is only verified on charts - I am fairly certain datagrids do not exhibit this behavior, but it is worth checking them all as well as asserting this behavior via tests.

import asyncio
import perspective
import random
import datetime

async def update(table):
    while True:
        now = datetime.datetime.now()
        data = [{"value": 1, "label": "L1", "timestamp": now}]
        for label in ("L1", "L2", "L3"):
            val = random.random()
            if val > 0.9:
                data.append({"value": val, "label": label, "timestamp": now})
        table.update(data)
        await asyncio.sleep(0.1)
        

schema = {
    "timestamp": datetime.datetime,
    'value': float,
    'label': str,
}

table = perspective.Table(schema, limit=10)
widget = perspective.PerspectiveWidget(table,  column_pivots=['label'], plugin="X/Y Scatter")
asyncio.get_event_loop().create_task(update(table))
widget # show

Expected Result:

L* column values mapped consistently to colors as the data source udpates.

Actual Result:

As the available values shifts from 0-3, the color mapping re-assigns already mapped colors.

Environment:

Chrome

texodus avatar Apr 20 '23 22:04 texodus

Hi @texodus i just noticed this particular bug has been fixed, I have been working on it for awhile only to notice its been fixed but the issue is still opened.

https://github.com/finos/perspective/assets/41238234/d5eedcb9-8786-4483-95e0-523d19064631

ralphmensah avatar Jul 06 '23 09:07 ralphmensah

This issue is certainly not fixed and you can see the reproduction in the legend of the video you posted. This particular clip happened to always have 0 and 1 values present, but 2 slides off at 0:002 and the legend drops it from the schema.

texodus avatar Jul 06 '23 14:07 texodus

Initially it had the colours changing on update for the same value, but it seems that isn't happening anymore.So I'm guessing that isn't the issue, Sorry I am new on perspective.

ralphmensah avatar Jul 10 '23 09:07 ralphmensah