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

Add the ability to drag custom price line and change its price #1086

Closed
randalhsu opened this issue May 31, 2022 · 15 comments
Closed

Add the ability to drag custom price line and change its price #1086

randalhsu opened this issue May 31, 2022 · 15 comments
Labels
enhancement Feature requests, and general improvements. plugin This feature request should/could be implemented as a Plugin.

Comments

@randalhsu
Copy link

randalhsu commented May 31, 2022

Is your feature request related to a problem? Please describe.

No.

Describe the solution you'd like

Able to drag custom price line.
Demo (The orders can be dragged in the price scale.)

I already have a patch implementing this.
Might take some efforts to rebase and write test case etc. if this feature request is approved.

Additional context

Proposal:

  1. Add boolean parameter draggable to createPriceLine().
  2. Able to get "the price before dragging". I think it should be stored as a string to preserve precisions? User can parse it later if needed.
  3. Change cursor when hovering over a draggable price line or dragging.
@julio899
Copy link

That's amazing how I can help?

@randalhsu
Copy link
Author

That's amazing how I can help?

Maybe push the maintainers to approve this feature?
I think there won't be any progress before approval.
https://github.com/tradingview/lightweight-charts/blob/master/CONTRIBUTING.md#pull-requests
Thank you for the interest.

@SlicedSilver SlicedSilver added the enhancement Feature requests, and general improvements. label Aug 26, 2022
@shaunbeh
Copy link

shaunbeh commented Sep 2, 2022

@randalhsu hi and tnx for ur work
I really need this feature and was hoping to have the library code till this gets approved,
u have provided the production ready file in ur demo and patch files and can't run npm run build because there is no subscribeCustomPriceLineDragged function in the main library, what should I do to have this in a react project?

tnx and sorry for the stupid question I have asked, Im new to this part of github and tweeking library files

@randalhsu
Copy link
Author

@shaunbeh
Manually build lightweight-charts with the patch:

git clone https://github.com/tradingview/lightweight-charts.git
cd lightweight-charts
git checkout -b v3.8.0 tags/v3.8.0
wget https://github.com/randalhsu/OPAL/raw/main/lightweight-charts-patch/0002-Draggable-custom-price-line.patch
git am 0002-Draggable-custom-price-line.patch
npm install --legacy-peer-deps
npm run build:prod

You need to use this file: dist/lightweight-charts.standalone.production.js

@mr-smit
Copy link

mr-smit commented Sep 27, 2022

Thanks for your work, was thinking to implement this, but you already did it. thanks.

@julio899
Copy link

@shaunbeh Manually build lightweight-charts with the patch:

git clone https://github.com/tradingview/lightweight-charts.git
cd lightweight-charts
git checkout -b v3.8.0 tags/v3.8.0
wget https://github.com/randalhsu/OPAL/raw/main/lightweight-charts-patch/0002-Draggable-custom-price-line.patch
git am 0002-Draggable-custom-price-line.patch
npm install --legacy-peer-deps
npm run build:prod

You need to use this file: dist/lightweight-charts.standalone.production.js

Thanks so much I appreciate a lot.

@felipecsl
Copy link
Contributor

Is there an existing pull request with this change? I couldn't find any. If not, I'd be happy to put one together since I need this change as well

felipecsl added a commit to huskly/lightweight-charts that referenced this issue Dec 8, 2022
@felipecsl
Copy link
Contributor

Code is here huskly/lightweight-charts@master...felipecsl:lightweight-charts:feat--drag-price-line
Keep in mind that it also includes changes from #1214 which are also present in my fork of the library.
I pushed it to npmjs.org here
Once #1214 is merged I can send a separate pull request for this change

@randalhsu
Copy link
Author

@felipecsl There's no pull request yet. Thanks for helping, hope it gets merged soon.

@jussirantala
Copy link

jussirantala commented Feb 3, 2023

Code is here felipecsl/lightweight-charts@master...felipecsl:lightweight-charts:feat--drag-price-line Keep in mind that it also includes changes from #1214 which are also present in my fork of the library. I pushed it to npmjs.org here Once #1214 is merged I can send a separate pull request for this change

@felipecsl #1214 is now merged :)

@kevinkga
Copy link

Code is here felipecsl/lightweight-charts@master...felipecsl:lightweight-charts:feat--drag-price-line Keep in mind that it also includes changes from #1214 which are also present in my fork of the library. I pushed it to npmjs.org here Once #1214 is merged I can send a separate pull request for this change

I just tried the latest version (4.0.7) of your fork but chart.subscribeCustomPriceLineDragged seems to be missing. Am I looking at the right version?

@felipecsl
Copy link
Contributor

@kevinkga yeah that's not the right version. You'll have to grab an older version to pick up that change, but those will be a bit outdated. I can probably sync it with the latest and publish a new version with it

@darwin403
Copy link

darwin403 commented May 7, 2023

@SlicedSilver can you please consider this in one of the future releases? This would be great for order placement mechanisms.

@brlocky
Copy link

brlocky commented May 29, 2023

@felipecsl

thank you for this amazing feature.

I confirm that version 4.0.4 is working fine. 4.0.5 and 4.0.6 are not
"@felipecsl/lightweight-charts": "4.0.4",

difurious added a commit to difurious/lightweight-charts-line-tools that referenced this issue Jun 13, 2023
…al lines and it seemed to fail some graphical tests pertaining to gradients and or transparency. I dont know why. Someone is already working on implementing it to V4 here

tradingview/lightweight-charts#1086  So i am deferring to that.
@SlicedSilver
Copy link
Contributor

Thank you for your feature request for Lightweight Charts. In order to keep the library lightweight and maintain a narrow focus, we strive to include only strictly required features in the core library. As a result, we have decided that this requested feature should be implemented as a plugin instead, and will be closing this issue as a result.

We recently introduced the ability to write plugins for Lightweight Charts, allowing users like you to extend the functionality of the library without adding it to the core. We highly recommend implementing your feature request as a plugin to achieve the desired functionality while keeping the core bundle size smaller for all users.

To get started with plugins, please refer to our Plugins Documentation for a better understanding of what is possible and how plugins work. You can also explore our collection of plugin examples (with a preview hosted here) for inspiration and guidance on implementing specific functionality.

For your particular feature request, we suggest taking a look at the following examples (see above links):

  • User Defined Price Lines
  • User Price Alerts

To help you get started quickly, we have created an NPM package called create-lwc-plugin, which sets up a plugin project for you. This way, you can hit the ground running with your plugin development.

If you do create a plugin based on your feature request, we would appreciate it if you could publish it on GitHub or NPM and let us know. This way, we can share it with the rest of the community. It would be helpful if you could prefix your NPM package name with lwc-plugin- for easier discoverability by others.

Thank you for your understanding and support. We believe implementing your feature request as a plugin will greatly benefit both you and the Lightweight Charts community.

@SlicedSilver SlicedSilver added the plugin This feature request should/could be implemented as a Plugin. label Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests, and general improvements. plugin This feature request should/could be implemented as a Plugin.
Projects
None yet
Development

No branches or pull requests

10 participants