Closed hughess closed 1 year ago
Latest commit: d6a8405f64d6f8a786218df4d0f1cdf51f0f596c
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git βοΈ
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
evidence-docs | β Ready (Inspect) | Visit Preview | π¬ Add feedback | May 18, 2023 5:17pm |
Name | Link |
---|---|
Latest commit | d6a8405f64d6f8a786218df4d0f1cdf51f0f596c |
Latest deploy log | https://app.netlify.com/sites/evidence-development-workspace/deploys/64665d88f17eef000800c1b8 |
Deploy Preview | https://deploy-preview-858--evidence-development-workspace.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
The last outstanding issue that may need to be tackled before merging is the default styling of labels. The basic labels look fine, but when a label is overtop of lines/bars/etc it doesn't look right.
Options are adding a white outline on the text or adding a background colour to the label (either full opacity or with some transparency).
Given the number of permutations here, it might be worth merging with a small white text outline as a starting point, and spending time to solve this in a more general sense once we have a bit of user feedback.
Update: I've added a white text outline by default on reference line labels, but have also included a prop for labelBackground
which if set to true, will include a white semi-transparent background behind the label
Thanks @archiewood.
labelPosition
for reference line, so that might help some of the issues thereyMin
and yMax
for ref areahideValue
I think I want more precisions on target line label than the axis. Should I be able to configure this?
What do you mean by precisions?
I was trying to achieve two lines where the labels didn't overlap
By more precision (typo), here I meant I wanted the format to show $3,800 not $4k.
Ahh that's a great point. Do you think a good solution to that might be a format override prop like valueFmt
or similar?
Yes I think so. Or accept the format function as I tried and failed to do
I've added value format control to the list of future improvements.
Just pushed some simplification to the props and label positions
Ran into 2 last issues on this:
Using a text border on the labels causes an issue with rendering in Safari. This is an echarts bug - I've opened an issue here: https://github.com/apache/echarts/issues/18609
Using a reference area on a bar chart where the x-axis is numeric or date, the are will only go to the specific point on the x-axis and will not cover the entire bar:
This is because the area is lined up to the exact point on the axis.
There are 2 possible workarounds:
For example, this chart is set with xMin='2020-12-15'
and xMax='2021-07-15'
This is not ideal, as it then removes automatic formatting of the x-axis labels. I would say this is not a viable workaround
There are a couple of ways to work around this on our side by extracting and adjusting the coordinates from echarts. These may be worth doing if the above workaround isn't intuitive.
@hughess as discussed I think we should probably leave the behaviour as is for numeric axes highlighting.
It's kind of a difficult problem as barcharts are sort of a discrete chart type, but are often used in a continuous setting (eg dates, numeric ranges).
Given the workarounds exist (workaround 1 in particular), I think until we are clear on what users need here, leaving as is makes sense
There are only 2 things blocking this PR from merging:
Removed formatting checks for markdown files in the example project +page.md
files.
Description
This PR adds reference lines and areas to charts.
For now, these are separate components:
ReferenceLine
andReferenceArea
, which are used by inserting them into a slot within a chart. For example:These can be applied by hardcoding values (e.g., if you want a horizontal line at y=50) or with a dataset (e.g., you have a table of events or time ranges you want to include in a chart to add context to the viz).
Reference Line
Props
Required:
x
ory
Optional:
data
label
color
lineType
lineColor
labelColor
lineWidth
showValueInLabel
labelTextOutline
labelBackground
Reference Area
Props
Required:
x1
,x2
,y1
,y2
Optional:
data
label
color
opacity
labelColor
border
borderColor
borderType
borderWidth
labelPosition
Use Cases
This opens up some pretty exciting use cases for adding relevant context to data viz.
To Do
AddlineType
prop to reference line (dashed, solid, etc)Formatted label numbersHow to treat label when no label is supplied (show value or nothing?)Fix gridline z level - histogram issueFix tooltip hover issue by setting markLine and markArea to silentWork in composable charts?Open slots on all XY chart typesNaming - highlight area?SwitchyVal
toy
?SwitchyMin
toy0
ory1
?Default label positions (swapXY, chart types, etc.)Error handlingStyling for labels - add white outline to text? Inherit colour of area background for that outline?Add docsAdd note to docs for gridline overlap issue with reference area labelAdd note to docs about continuous axis bar charts - reference area doesn't cover bar by defaultDeferred for future upgrades
bar
rather thanline
as it is nowcolor=red
inReferenceArea
and have it produce a faded red/pink background with a darker red labelIssues to be solved
Error Handling
Implemented using the
ErrorChart
component.Covers these scenarios:
Checklist