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

add Chart2Music keyboard and sound accessibility features #6680

Draft
wants to merge 120 commits into
base: master
Choose a base branch
from

Conversation

aliwelchoo
Copy link

Use data and layout to call the chart2music API inside makePlot.

This pull request is for scatter plots only

@aliwelchoo aliwelchoo changed the title Add Chart2Music keyboard and sound accessibility features add Chart2Music keyboard and sound accessibility features Jul 21, 2023
@aliwelchoo
Copy link
Author

  • Closed captions element is required to be visible on the screen to function so need to find a way to integrate it more cleanly
  • Need to rebase

@alexcjohnson
Copy link
Collaborator

Excited for this!
FYI @julianna-langston @spmealin - I think we can sort out most of what we need but your feedback is of course welcome!

@archmoj thoughts about packaging? Is a 50kb increase in minified bundle acceptable or should we keep chart2music external like MathJax? If we did make it external we'd probably want it included by default in plotly.py output, and we could have Dash detect and autoload it, but plain plotly.js users would need to explicitly load it

@aliwelchoo aliwelchoo marked this pull request as draft July 24, 2023 21:34
package.json Outdated
@@ -77,6 +77,7 @@
"@turf/bbox": "^6.4.0",
"@turf/centroid": "^6.0.2",
"canvas-fit": "^1.5.0",
"chart2music": "^1.11.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice MIT library.
To transpile it to es5, please add it to

include: /node_modules[\\\/](buffer|d3-color|d3-interpolate|is-mobile)[\\\/]/,

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! Knew there'd be something simple I was missing so I could get this into the same style

@@ -0,0 +1,71 @@
"use strict";
import c2mChart from "chart2music";
Copy link
Contributor

Choose a reason for hiding this comment

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

To pass current es5 build tests, this file should be written in es5 style similar other files to src.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need to be writing in es5? Won't webpack take that and give us the desired output? I'd love it if we can start accepting (and eventually converting existing code to) more modern syntax.

Copy link
Contributor

Choose a reason for hiding this comment

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

For es modules, we have a config rule in place.
I did try to add a rule to transpile this file during build processes; but npm run build wasn't successful in the past hour.
If one could help with setting up the webpack config, it would be great 🙏

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for these tips again! I've made some attempts at this (putting chart2music and/or accessibility.js into the webpack config but struggling with "Cannot find module 'chart2music'" whenever I use require instead of import. I think I'm still missing something

var {type, x = [], y = [], name = i, text = []} = trace;
if(type === 'scatter') {
var traceData = [];
if ('y' in trace) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In scatter traces with orientation: 'h', we should use trace.x instead of trace.y.

}
else {
// 'Accessibility not implemented for trace type: ' + trace.type
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps we should use continue instead of return here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes I think so. There's some overview text c2m reads out when you first focus on the chart, right? Perhaps we can have any skipped traces briefly mentioned there?

Copy link
Author

Choose a reason for hiding this comment

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

I can look into this. Need to look into where that closed captions text element goes in general, not sure about outputting our own messages into it, it's more than just the overview at the start, also reads off the data as you navigate it.

But this general point is a good one, ideally want to be able to support more than just scatter traces and want to support figures containing unsupported traces alongside supported ones.

Then there's also the opportunity for a config option to say which traces should be in accessibility mode

Choose a reason for hiding this comment

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

This is an interesting use case. I've created a feature request for chart2music to add config so that you can specify skipped traces (aka unsupported layers). If you think that would work for you, I'll go ahead and get started on a PR for chart2music.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@julianna-langston that would be great! I think that's going to be really important for this project, so that plotly.js and Dash users who care about this can turn on chart2music in all of their charts, knowing that the result will not always be complete but will always be as useful as it can be and will tell them what they're missing. And then over time as both the plotly.js and the chart2music sides add more features, existing applications will automatically improve.

Choose a reason for hiding this comment

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

Chart2Music v1.12 now has an unsupported chart type. Examples and documentation


c2mChart({
title: title_text,
type: "line",
Copy link

Choose a reason for hiding this comment

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

If this PR is for scatter plots, you probably want to have type: "scatter".

In the future, if someone wants to support more chart types, chart2music supports an array. So, if you have 2 traces, 1 scatter and 1 line, you could convert that to chart2music's type: ["line", "scatter"]. Just fyi.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you. I think I'll end up extending the scope to as many types as we can

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for supporting our project, @julianna-langston

@aliwelchoo aliwelchoo marked this pull request as ready for review July 26, 2023 16:59
@aliwelchoo aliwelchoo marked this pull request as draft July 26, 2023 17:00
@archmoj
Copy link
Contributor

archmoj commented Feb 28, 2024

Alright, I opened #6909 and merge it into chart2music_dev branch. All the tests are green there. So let's pull/merge that here.

@ayjayt
Copy link
Contributor

ayjayt commented Feb 29, 2024

thanks @archmoj!

@ayjayt
Copy link
Contributor

ayjayt commented Mar 10, 2024

Todo 1: #6680 (comment)
Todo 2: #6680 (comment)

just copying this here because it all got lost with the big merge

@ayjayt
Copy link
Contributor

ayjayt commented Mar 11, 2024

@ayjayt
Copy link
Contributor

ayjayt commented Mar 18, 2024

This is on track (it's not obvious here because my last two blocks I've been focused on the c2m repository)! When the infrastructure is done (probably next weekend), it will be ready for systematic integration with all of plotly's plot types. I will get us started with 2 or 3 (aliwelchoo already did a lot of linear), but I'm not as familiar with all of plotly's plot types as some of you so I will write documentation to make it easy, organized, and systematic to:

  1. discover which of plotly's graph types aren't supported yet
  2. write the pursuant support

I promise it will be very straightforward.

@Coding-with-Adam
Copy link
Contributor

Thank you so much with your support on this, @ayjayt

@archmoj
Copy link
Contributor

archmoj commented Mar 20, 2024

We fixed a problem on CircleCI (#6935).
Please pull upstream/master and merge it into this branch.

@ayjayt
Copy link
Contributor

ayjayt commented Apr 1, 2024

I'm back 😎, lets see what we can´t finish today :-)

@gvwilson gvwilson self-requested a review May 2, 2024 14:41
@gvwilson gvwilson self-assigned this May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants