-
Notifications
You must be signed in to change notification settings - Fork 3
feat(Legend): add left and right options to legend.position config
#280
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
Changes from 7 commits
b0254f1
93e77bf
c90ac4c
42d5abb
3a334f6
48439d7
7b2cde9
48fdbea
63f5644
25640f5
47692b9
63a4684
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does there seem to be enough space from below? I would have expected to see more series in legend to take up all the available space
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'll take a look at it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| export * from './bands'; | ||
| export * from './crosshair'; | ||
| export * from './legend-position'; | ||
| export * from './line-and-bar'; | ||
| export * from './lines'; | ||
| export * from './tooltip'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import type {ChartData, LineSeries} from '../../../types'; | ||
| import {lineBasicData} from '../line/basic'; | ||
|
|
||
| function prepareData(): ChartData { | ||
| const baseSeries = lineBasicData.series.data[0] as LineSeries; | ||
| const seriesNames = [ | ||
| 'Series 1', | ||
| 'Very looooooooooooooooooooooooooooooooooooooooong series name', | ||
| ]; | ||
|
|
||
| const series: LineSeries[] = Array.from({length: 20}, (_, i) => ({ | ||
| ...baseSeries, | ||
| name: seriesNames[i % seriesNames.length], | ||
| data: baseSeries.data.slice(0, 20).map((point) => ({ | ||
| ...point, | ||
| y: typeof point.y === 'number' ? point.y + Math.random() * 10 - 5 : point.y, | ||
| })), | ||
| })); | ||
|
|
||
| return { | ||
| series: { | ||
| data: series, | ||
| }, | ||
| yAxis: [ | ||
| { | ||
| title: { | ||
| text: 'User score', | ||
| }, | ||
| }, | ||
| ], | ||
| xAxis: { | ||
| type: 'datetime', | ||
| title: { | ||
| text: 'Release dates', | ||
| }, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| export const legendPositionData = prepareData(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@korvin89 @kuzmadom
Can you tell me if there are any requirements for centering the legend along the vertical axis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an additional field such as verticalAlign is suitable for vertical positioning of the legend (similar to horizontal
align?: 'left' | 'center' | 'right';)But this can (should) be done in a separate pr. For the legend to be positioned on the left/right, the current top-only positioning is enough - this is ok in my opinion
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will try to implement this in the next pr.