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

texttemplate with date formatting #4071

Merged
merged 43 commits into from
Aug 28, 2019
Merged

texttemplate with date formatting #4071

merged 43 commits into from
Aug 28, 2019

Conversation

antoinerg
Copy link
Contributor

@antoinerg antoinerg commented Jul 22, 2019

This partially closes #3816 by adding textemplate support to traces with textinfo:

  • pie
  • sunburst
  • funnelarea
  • bar
  • waterfall
  • funnel
  • scatter

plus:

as well as GL traces:

  • scatter3d
  • scattergl
  • scatterpolargl

Also introduced in this PR is the ability to format dates in both (hover|text)template via pipe | (c6370d9 and 836d5a2).

TODO:

  • mock showing default date formatting in funnel and waterfall (db87e62)
  • merge (text|hover)templateAttrs into a single file (4ef8392)
  • mocks containing GL traces should have filenames prefixed by gl2d
  • for GL traces, pass through the current d3locale to texttemplateString (done in cbbcfcb)
  • DRY up bar routine (see texttemplate with date formatting #4071 (comment) for details) ?
  • make customdata variable available in texttemplate (e0bde45)
  • do not export internal function templateFormatString (ee0a309)
  • move texttemplate_attributes.js from fx to plots (ce3c9cc)
  • test that it does not coerce textinfo when texttemplate (9330290)
  • test that meta is available within texttemplate (e7c034a)

Add `textemplate` support to the following traces:

- [x] pie
- [x] sunburst
- [x] funnelarea
- [x] bar
- [x] waterfall
- [x] funnel
- [x] scatter
src/lib/index.js Outdated Show resolved Hide resolved
@antoinerg antoinerg added the feature something new label Jul 23, 2019
@@ -534,6 +537,64 @@ function getTextPosition(trace, index) {
return helpers.coerceEnumerated(attributeTextPosition, value);
}

function calcTexttemplate(fullLayout, calcTrace, index, xa, ya) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to merge this routine with calcTextinfo where we could first set the obj.??Label values and then use those to translate the textinfo flags.

@etpinard

This comment has been minimized.

@etpinard

This comment has been minimized.

@antoinerg

This comment has been minimized.

@nicolaskruchten

This comment has been minimized.

@etpinard

This comment has been minimized.

@nicolaskruchten

This comment has been minimized.

@antoinerg

This comment has been minimized.

@etpinard

This comment has been minimized.

@antoinerg

This comment has been minimized.

@antoinerg antoinerg changed the title texttemplate: initial implementation texttemplate with date formatting Aug 21, 2019
src/traces/bar/plot.js Outdated Show resolved Hide resolved
@@ -29,7 +29,7 @@ module.exports = {
moduleType: 'trace',
name: 'scatter3d',
basePlotModule: require('../../plots/gl3d'),
categories: ['gl3d', 'symbols', 'showLegend'],
categories: ['gl3d', 'symbols', 'showLegend', 'scatter-like'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you add 'scatter-like' here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, you're using traceIs(trace, 'scatter-like') in your tests. A quick grep reveals that 'scatter-like' is only used in two places, in modebar/manage.js and for some restyle call. Adding it to scatter3d won't break anything and is arguably the thing to do, so I'm 👌 with this.

@etpinard
Copy link
Contributor

Awesome PR @antoinerg !!

💃 💃 💃 - let's get the 1.50.0 🚋 up and running!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

texttemplate
5 participants