Skip to content

Commit 58d994a

Browse files
8: update CHANGELOG and README
1 parent 3ae13c2 commit 58d994a

File tree

3 files changed

+80
-5
lines changed

3 files changed

+80
-5
lines changed

packages/lib/CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Lightweight Charts React Wrapper changelog
2+
3+
## 2.0.0
4+
5+
In this major release, the required version of the Lightweight Charts package has been upgraded to 4.0.0 to support the package's new features.
6+
7+
Check out `[email protected]` [release notes](https://github.com/tradingview/lightweight-charts/releases/tag/v4.0.0) first.
8+
9+
### Breaking changes
10+
11+
- ESM only (CJS support can be added on demand in the future).
12+
- Properties that were renamed or removed in `[email protected]` were also renamed or removed in wrappers.
13+
14+
### New features
15+
16+
- Added `markers` property to `<[Type]Series>` components.
17+
- Supported `autoSize` option on `<Chart>` component.
18+
- Reduced layout shift on SSR. The chart component will reserve the specified width and height if the chart is not auto-sized. New `[email protected]` features are also available without being explicitly mentioned in this changelog.
19+
20+
New `[email protected]` features are also available without being explicitly mentioned in this changelog.

packages/lib/README.md

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,62 @@ To pass a data to a series you can use the `data` property. Look [here](https://
9292
By default `data` represents only the **initial** data. Any subsequent data update does not update series.
9393
If you want to change this behavior please add `reactive={true}` to your series component. In this case series will apply a new data if it is not reference equal to previous array.
9494

95-
### Other components
95+
#### Passing markers
96+
To pass markers to a series you can use the `markers` property. Markers should be an array of `SeriesMarker<Time>`.
97+
98+
### Price line
99+
100+
To draw price line add `<PriceLine>` component inside any series.
101+
```jsx
102+
<Chart width={600} height={300}>
103+
<LineSeries data={data}>
104+
<PriceLine
105+
title="minimum price"
106+
price={minimumPrice}
107+
/>
108+
<PriceLine
109+
title="average price"
110+
price={avgPrice}
111+
/>
112+
<PriceLine
113+
title="maximum price"
114+
price={maximumPrice}
115+
/>
116+
</LineSeries>
117+
</Chart>
118+
```
119+
120+
You can pass any options from [`PriceLineOptions`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/PriceLineOptions) as separate property. The `price` property is mandatory in dev mode.
121+
122+
Use the `ref` property to get reference to a [`IPriceLine`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/IPriceLine) instance.
123+
124+
### Time scale
125+
126+
`<TimeScale>` - the component is a binding to the current time scale of the current chart.
127+
This component has to be nested inside a chart component and should not have duplicates. Each chart has only one time scale.
128+
129+
You can pass any option from [`TimeScaleOptions`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/TimeScaleOptions) as separate property.
130+
131+
Events:
132+
- [`onVisibleTimeRangeChange`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/ITimeScaleApi#subscribevisibletimerangechange) - `(timeRange: TimeRange | null) => void`
133+
- [`onVisibleLogicalRangeChange`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/ITimeScaleApi#subscribevisiblelogicalrangechange) - `(logicalRange: LogicalRange | null) => void`
134+
- [`onSizeChange`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/ITimeScaleApi#subscribesizechange) - `(width: number, height: number) => void`
135+
136+
Use the `ref` property to get reference to a [`ITimeScaleApi`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/ITimeScaleApi) instance.
137+
138+
Note: don't use `ChartOptions['timeScale']` and `<TimeScale>` component at the same time. This can lead to uncontrolled overwriting of options.
139+
140+
### Price scale
141+
142+
`<PriceScale>` - the component is a bindings to a certain price scale.
143+
This component has to be nested inside chart component and requires an `id` property. Two price scales with the same `id` within the same chart result in undefined behaviour.
144+
145+
You can pass any option from [`PriceScaleOptions`](https://tradingview.github.io/lightweight-charts/docs/api/interfaces/PriceScaleOptions) as separate property.
146+
147+
Note: don't use `ChartOptions['leftPriceScale']'` or `ChartOptions['rightPriceScale']` or `ChartOptions['overlayPriceScale']` and `<PriceScale>` at the same time. This can lead to uncontrolled overwriting of options.
148+
149+
## Licence
150+
151+
MIT
96152

97-
- `<PriceLine>` - price line (`IPriceLine`). It has to be nested inside `<[Type]Series>` component.
98-
- `<TimeScale>` - time-scale (`ITimeScaleApi`). It has to be nested inside `<Chart>` component.
99-
- `<PriceScale>` - price-scale (`IPriceScaleApi`). It has to be nested inside `<Chart>` component.
153+
Review the license [requirements](https://github.com/tradingview/lightweight-charts#license) for the required "attribution notice" in the Lightweight Chart Repository.

packages/lib/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightweight-charts-react-wrapper",
3-
"version": "1.3.3",
3+
"version": "2.0.0",
44
"description": "",
55
"type": "module",
66
"exports": "./dist/index.js",
@@ -16,6 +16,7 @@
1616
"files": [
1717
"dist/**/*",
1818
"README.md",
19+
"CHANGELOG.md",
1920
"LICENSE"
2021
],
2122
"license": "MIT",

0 commit comments

Comments
 (0)