From: Stas Vilchik Date: Wed, 9 Dec 2015 14:25:55 +0000 (+0100) Subject: add tooltips for ncloc distribution chart X-Git-Tag: 5.3-RC2~33 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e450db4e1969069d82574f77b5978e9dad975787;p=sonarqube.git add tooltips for ncloc distribution chart --- diff --git a/server/sonar-web/src/main/js/apps/overview/components/ncloc-distribution.js b/server/sonar-web/src/main/js/apps/overview/components/ncloc-distribution.js index 764457ad403..0a24b77c65d 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/ncloc-distribution.js +++ b/server/sonar-web/src/main/js/apps/overview/components/ncloc-distribution.js @@ -65,7 +65,12 @@ export const NclocDistribution = React.createClass({ data = _.sortBy(data, d => -d.x); - let yTicks = data.map(d => collapsePath(d.value, 20)); + let yTicks = data.map(d => { + return { + label: collapsePath(d.value, 20), + tooltip: d.value + }; + }); let yValues = data.map(d => formatMeasure(d.x, 'SHORT_INT')); diff --git a/server/sonar-web/src/main/js/components/charts/histogram.js b/server/sonar-web/src/main/js/components/charts/histogram.js index ffac187583c..c64146f2d28 100644 --- a/server/sonar-web/src/main/js/components/charts/histogram.js +++ b/server/sonar-web/src/main/js/components/charts/histogram.js @@ -40,17 +40,24 @@ export const Histogram = React.createClass({ return null; } let ticks = this.props.yTicks.map((tick, index) => { - let point = this.props.data[index]; - let x = xScale.range()[0]; - let y = Math.round(yScale(point.y) + yScale.rangeBand() / 2 + this.props.barsHeight / 2); - return {tick}; + const point = this.props.data[index]; + const x = xScale.range()[0]; + const y = Math.round(yScale(point.y) + yScale.rangeBand() / 2 + this.props.barsHeight / 2); + const label = tick.label ? tick.label : tick; + const tooltip = tick.tooltip ? tick.tooltip : null; + return + {label} + ; }); return {ticks}; },