night-vision icon indicating copy to clipboard operation
night-vision copied to clipboard

Real time data and navi scripts

Open KatarinaSmirnova opened this issue 1 year ago • 2 comments

Describe the bug

Hi, I've been working with the library and it looks great. I have a problem adding a script with ‘navi’ when using real time data.

` // Navy ~ 0.1-lite

// Meta tag [OVERLAY name=Custom, ctx=Canvas, author=ChartMaster, version=1.0.0] console.log("Draw function called");
draw(ctx) { console.log("Draw function called");
}

`

` let chart = new NightVision("chart-container", { autoResize: true, colors: { back: "#111113", grid: "#2e2f3055", }, scripts: [Custom] });

`

I just want to be able to log a message at that time and it never arrives. Previously adding data to a test JSON file bugged the whole graph, any solutions, thanks! I make a clarification, in sandbox I seem to have some problems updating the ws, the client blocks it.

Reproduction

https://codesandbox.io/p/sandbox/playing-around-10-forked-problem-kg6gtq?file=%2Fmain.js

Steps to reproduce

No response

Javascript Framework

no-framework (vanilla-js)

Logs

No response

Validations

  • [X] Read the docs.
  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Make sure this is a NightVision issue and not a framework-specific issue.
  • [X] The provided reproduction is a minimal reproducible example of the bug.

KatarinaSmirnova avatar May 05 '24 20:05 KatarinaSmirnova

I think you need to add this. I'm not totally sure if type and name are correct tho.. Since you have added in the script, you have to attach a overlay for that script.

chart.data.panes[0].overlays.push({
    type: "Custom",
    name: "Custom",
    data: [],
    props: {},
    settings: {
      zIndex: 1
    }
  })

vattevaii avatar Jul 13 '24 15:07 vattevaii