Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request overlays #20

Open
frbju opened this issue Nov 28, 2022 · 1 comment
Open

Request overlays #20

frbju opened this issue Nov 28, 2022 · 1 comment

Comments

@frbju
Copy link

frbju commented Nov 28, 2022

I would like to request interactive horizontal and vertical lines.
example:

{
    type: 'hline',
    interactive: true,
    data: <value>,
    settings: {},
    props: {
        "color": rgba()
    }
},
{
    type: 'vline',
    interactive: true,
    data: <timestamp>,
    settings: {},
    props: {
        "color": rgba()
    }
}

Then handles to get data

hline.on('start', { })
hline.on('drag', { })
hline.on('end', { })

Reason for this is that i want to have lines for my entry / takeprofit / stoploss. And be able to drag ex stoploss to a new value then send a trigger back to backend.

Best / F

@frbju
Copy link
Author

frbju commented Dec 5, 2022

Hi, Could i get permissions to push? I would like to help with what i can :)

Iv'e made the base for vline & hline.

example:

// Navy ~ 0.1-lite
// ^^^ First comment should provide a NavyJS version

// Meta tag
[OVERLAY name = vLine, ctx = Canvas, author = ChartMaster, version = 1.0.0]

prop('color', { type: 'color', def: 'pink' })
prop('lineDash', { type: 'array', def: [2, 5] })
prop('lineWidth', { type: 'number', def: 1 })
prop('interactive', { type: 'boolean', def: false }) // Todo

draw(ctx) {
    const layout = $core.layout
    const data = $core.data
    let x = layout.time2x(data)
    
    ctx.strokeStyle = $props.color
    ctx.lineWidth = $props.lineWidth
    ctx.setLineDash($props.lineDash);

    ctx.beginPath()
    ctx.moveTo(x, 0)
    ctx.lineTo(x, layout.height)
    ctx.stroke()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants