You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/11/19 22:10:40 UTC

[GitHub] kristw closed pull request #6412: [bugfix] Use same xaxis formatter for line chart x-axis and tooltip

kristw closed pull request #6412: [bugfix] Use same xaxis formatter for line chart x-axis and tooltip
URL: https://github.com/apache/incubator-superset/pull/6412
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/assets/src/visualizations/nvd3/NVD3Vis.js b/superset/assets/src/visualizations/nvd3/NVD3Vis.js
index cdd938f893..7f9788fa75 100644
--- a/superset/assets/src/visualizations/nvd3/NVD3Vis.js
+++ b/superset/assets/src/visualizations/nvd3/NVD3Vis.js
@@ -514,7 +514,7 @@ function nvd3Vis(element, props) {
       chart.useInteractiveGuideline(true);
       if (vizType === 'line') {
         chart.interactiveLayer.tooltip.contentGenerator(d =>
-          generateRichLineTooltipContent(d, yAxisFormatter));
+          generateRichLineTooltipContent(d, xAxisFormatter, yAxisFormatter));
       }
     }
 
diff --git a/superset/assets/src/visualizations/nvd3/utils.js b/superset/assets/src/visualizations/nvd3/utils.js
index 4940f7ab26..52e0c3e5ec 100644
--- a/superset/assets/src/visualizations/nvd3/utils.js
+++ b/superset/assets/src/visualizations/nvd3/utils.js
@@ -1,7 +1,6 @@
 import d3 from 'd3';
 import d3tip from 'd3-tip';
 import dompurify from 'dompurify';
-import { formatDateVerbose } from '../../modules/dates';
 
 // Regexp for the label added to time shifted series
 // (1 hour offset, 2 days offset, etc.)
@@ -50,10 +49,10 @@ export function drawBarValues(svg, data, stacked, axisFormat) {
 
 // Custom sorted tooltip
 // use a verbose formatter for times
-export function generateRichLineTooltipContent(d, valueFormatter) {
+export function generateRichLineTooltipContent(d, timeFormatter, valueFormatter) {
   let tooltip = '';
   tooltip += "<table><thead><tr><td colspan='3'>"
-    + `<strong class='x-value'>${formatDateVerbose(d.value)}</strong>`
+    + `<strong class='x-value'>${timeFormatter(d.value)}</strong>`
     + '</td></tr></thead><tbody>';
   d.series.sort((a, b) => a.value >= b.value ? -1 : 1);
   d.series.forEach((series) => {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org