Comments (8)
Try the <details>
tag or conditional rendering.
from svelte-lightweight-charts.
Your fiddle uses an unofficial fork of lightweight-charts
with the moveCrosshair
extension method. You can provide it to svelte-lightweight-charts
via a bundler alias or a package manager alias.
I can only give an example of charts with synchronized scroll.
from svelte-lightweight-charts.
Yes it is possible.
<div id="chart" on:mousemove={handleChartContainerMouseMove}>
<Chart on:crosshairMove={handleChartCrosshairMove} ref={(ref) => chart = ref}>
<BarSeries/>
<TimeScale on:visibleLogicalRangeChange={syncWithAxis}/>
</Chart>
</div>
<div id="axis" on:mousemove={handleAxisContainerMouseMove}>
<Chart on:crosshairMove={handleAxisCrosshairMove} ref={(ref) => axis = ref}>
<LineSeries/>
<TimeScale on:visibleLogicalRangeChange={syncWithChart}/>
</Chart>
</div>
from svelte-lightweight-charts.
Example of event handler:
<TimeScale on:visibleLogicalRangeChange={(e) => axis.timeScale().setVisibleLogicalRange(e.detail)}/>
from svelte-lightweight-charts.
Your request is quite interesting, I will add the full implementation to the gallery of examples a bit later.
from svelte-lightweight-charts.
thanks for the solution. Please keep up the updates. The repo is really good.
Another question. Is it possible to close one of the multiple panes. For example the first graph is the main graph that shows the stock movement. Below is the second graph that is a indicator of that stock. I want to close the second graph with a button. How should i do this in svelte-lightweight-charts?
from svelte-lightweight-charts.
Yes it is possible.
<div id="chart" on:mousemove={handleChartContainerMouseMove}> <Chart on:crosshairMove={handleChartCrosshairMove} ref={(ref) => chart = ref}> <BarSeries/> <TimeScale on:visibleLogicalRangeChange={syncWithAxis}/> </Chart> </div> <div id="axis" on:mousemove={handleAxisContainerMouseMove}> <Chart on:crosshairMove={handleAxisCrosshairMove} ref={(ref) => axis = ref}> <LineSeries/> <TimeScale on:visibleLogicalRangeChange={syncWithChart}/> </Chart> </div>
Can you provide a full simple example of how to use it. Since i dont know how syncwithCart, handleAxisCrosshairMove etc are defined
from svelte-lightweight-charts.
Just for the record. If you have more than two graphs (e.g. Chart, RSI and MACD) and you want them sync then you have to modify the above code in the following way:
`
let axisRSI;
let axisMACD;
let chart;
const handleChartLogicalRangeChange = (e) => {
const range = e.detail;
try
{
axisRSI.timeScale().setVisibleLogicalRange(range);
}
catch(error) {
//pass;
}
try
{
axisMACD.timeScale().setVisibleLogicalRange(range);
}
catch(error) {
//pass;
}
}
const handleAxisLogicalRangeChange = (e) => {
const range = e.detail;
chart.timeScale().setVisibleLogicalRange(range)
}`
from svelte-lightweight-charts.
Related Issues (20)
- Version: 2.0.0
- Always show the newest data at first HOT 15
- I want to optionally apply rightPriceScale in LineSeries HOT 4
- Graph without zooming in HOT 3
- Show Price in Legend HOT 3
- Lineseries: Uncaught Error: Value is null HOT 2
- Better UX for Mobile Device HOT 5
- Does Lineseries and Candlestick only work with 'yyyy-mm-dd'? HOT 7
- Vertical Price Line HOT 3
- 2.1.0
- Fixed time interval HOT 1
- Feature Request HOT 5
- Continuous Pulse animation HOT 1
- **Not an Issue** - feature suggestion HOT 3
- **not an issue** feature question HOT 2
- Support plugins HOT 11
- Feature Request: Add Tracking Mode for mobile devices HOT 2
- Feature Request: Support Unix Timestamp
- Creating Minicharts HOT 4
- Time value above the vertical line HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte-lightweight-charts.