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

Chart Component Fixes/Improvements. Adds Tooltip to Provide Context on Component Input Types #13538

Merged
merged 123 commits into from May 21, 2024

Conversation

Ghrehh
Copy link
Collaborator

@Ghrehh Ghrehh commented Apr 22, 2024

Description

General Changes

  • Fixed an issue where alerts for required fields weren't showing up on freshly added chart components, fixed another related issue hidden by this bug where component controls nested in sections didn't check their parent's dependsOn field to check if they're own dependsOn validation should be ran.

Chart Changes

  • Upgraded to latest Apex charts
  • Removed use of Apex charts svelte shim; we now use the library directly.
  • Fixed an issue where selecting nullish or non-scalar values to display in multiselect charts would break the entire chart.
  • Histograms now work with negative values.
  • datetime labels now display a human readable date instead of a UNIX timestamp or raw ISO 8601 string.
  • Horizontal mode now works for histograms and bar charts with date labels.
  • Fixes an issue where switching to certain label types would break a chart component until page refresh.
  • datetime fields passed as values to charts are now converted to unix time integers, which seems potentially useful. They were previously handled by directly running "parseFloat" on them, only parsing the year of the iso string as a number, which didn't seem very useful.
  • In dev mode, if a chart is provided inputs that have no rows, an alert will tell users this is the case.
  • Removed the previous chart builder class, instead we explicitly build the Apex chart config object in each chart component, in my opinion this is much easier to understand, even if it's a bit more explicit, there's also less method calling boilerplate.
  • Candlestick charts can now accept numbers and string-like values as the date input if the values are correctly formatted.
  • Donut and Pie charts now longer break until page reload when a non-numeric value is selected as their value input.

Explanation Tooltip

  • Added a tooltip that provides information on column types and their compatibility with a particular component input when hovering over FieldSelects or MultiFieldSelects.
  • These tooltips also have further information that can be accessed on hover explaining certain topics, like how strings can be converted to numbers for numerical inputs.
  • There are some other QoL features, like being able to see an at a glance summary of the configuration of a particular column, and the ability to jump straight to things like documentation and the column's table, and example of these are below, though there are more.
info image
column details menu Screenshot 2024-04-22 at 09 29 33
compatibility details menu Screenshot 2024-04-22 at 09 29 19
explanation tooltip Screenshot 2024-04-22 at 09 28 57

Feature branch env

Feature Branch Link

@Ghrehh Ghrehh requested a review from a team as a code owner April 22, 2024 08:57
@Ghrehh Ghrehh requested review from adrinr and removed request for a team April 22, 2024 08:57
@aptkingston aptkingston added the feature-branch Release this PR code into a feature branch label Apr 22, 2024
@Ghrehh Ghrehh force-pushed the fix-chart-data-selection-2 branch from c2bd82d to 53553d8 Compare April 22, 2024 13:37
@Ghrehh Ghrehh added feature-branch Release this PR code into a feature branch and removed feature-branch Release this PR code into a feature branch labels Apr 26, 2024
Copy link
Contributor

@deanhannigan deanhannigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fantastic piece of work Gerard! The UX improvements to charts make such a huge difference and I genuinely want to see your context menus everywhere in Budibase 🚀 They are a brilliant bit of design and incredibly intuitive!

Some minor comments in the PR and some bugs/notes outlined here:

Bug custom color theme palette not loading

  • This seems to be an issue on all chart types

Bug - QR not compatible for Label/Data column

  • The value of a QR code will always resolve to a string
  • In many cases, the text could be appropriate for both string or number like fields.

Note

  • Different layout for Pie chart? Is this intentional?
  • Prod has a larger diagram with a scrollable legend on the right
  • New UX has a small diagram with a static legend at the top.

Note popover color

  • Nested Props in formblock
    • --spectrum-global-color-gray-100
  • Context popover background is currently set to
    • --spectrum-global-color-gray-75

Note

  • I'm not sure the bullet points are required in the primary hover. Purely an opinion, in no way a blocker.

packages/bbui/src/Form/Core/Picker.svelte Outdated Show resolved Hide resolved
packages/bbui/src/Tooltip/Context.svelte Show resolved Hide resolved
packages/builder/src/stores/builder/components.js Outdated Show resolved Hide resolved
packages/client/manifest.json Outdated Show resolved Hide resolved
packages/client/package.json Outdated Show resolved Hide resolved
packages/client/src/components/app/charts/ApexChart.svelte Outdated Show resolved Hide resolved
packages/client/src/components/app/charts/ApexChart.svelte Outdated Show resolved Hide resolved
@Ghrehh
Copy link
Collaborator Author

Ghrehh commented May 14, 2024

@deanhannigan Thanks a bunch for the thorough review, I've addressed or responded to everything, if you could give this another looks when you get a chance I'd appreciate it 🙏

Copy link
Contributor

@deanhannigan deanhannigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor note for the custom palette issue and one change to the Explanation background colour and this is good to go 👍

@Ghrehh
Copy link
Collaborator Author

Ghrehh commented May 14, 2024

@deanhannigan Had changed the colors of the modal before I think, but there was a redundant double declaration of the background colour in two different nested components, it's definitely background-color: var(--spectrum-global-color-gray-100) on both tooltips now (which I think is the color you wanted, I maybe misread)

Copy link
Contributor

@deanhannigan deanhannigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Great work Gerard!

Copy link
Member

@aptkingston aptkingston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huge amount of work here! The amount of components added for all the explanation stuff is insane.

No major issues at all, just NABs. I agree with Dean in principle about casing (just because the DOM syntax is a certain way doesn't we can't make it more readable in our own code) but again that's very much NAB.

So I'm happy to merge away as is 👍

Great to make the charts more stable.

@@ -199,6 +201,8 @@
aria-selected="true"
tabindex="0"
on:click={() => onSelectOption(getOptionValue(option, idx))}
on:mouseenter={e => onOptionMouseenter(e, option)}
on:mouseleave={e => onOptionMouseleave(e, option)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: would be nice to dispatch custom optionenter and optionleave events here, which can be just proxied on up the component chain rather than having to have a bunch of prop drilling with NOPs but it's not a big deal - works the same.

@@ -283,10 +283,23 @@
const dependsOnKey = setting.dependsOn.setting || setting.dependsOn
const dependsOnValue = setting.dependsOn.value
const realDependentValue = instance[dependsOnKey]

const sectionDependsOnKey =
setting.sectionDependsOn?.setting || setting.sectionDependsOn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you're doing with this (I remember the awkwardness before of trying to define the chart settings in a way that the "depends on" stuff worked with only a single key) but to be honest this would motivate me to rewrite dependsOn to just support an array of keys. We could still do what you're doing below and dynamically enrich the setting dependsOn keys with any keys from the section itself.

We can handle that separately though - this PR is big enough already!

@Ghrehh Ghrehh force-pushed the fix-chart-data-selection-2 branch from fcfdf9b to 04cf17c Compare May 21, 2024 08:51
@aptkingston aptkingston merged commit e269f91 into master May 21, 2024
10 checks passed
@aptkingston aptkingston deleted the fix-chart-data-selection-2 branch May 21, 2024 09:00
@github-actions github-actions bot locked and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-branch Release this PR code into a feature branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants