Commit 73dbc288 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Fixed number precision and boxplot layout issues

parent fa83dae2
Pipeline #4498 failed with stages
in 6 minutes and 59 seconds
...@@ -40,16 +40,19 @@ ...@@ -40,16 +40,19 @@
ANOVA -- F-value: {{ anova.fValue }} ANOVA -- F-value: {{ anova.fValue }}
&nbsp p-value: {{ anova.pValue }} &nbsp p-value: {{ anova.pValue }}
</text> </text>
<g class="fjs-boxplot-axis fjs-x-axis" ref="xAxis" :transform="`translate(0, ${padded.height})`"></g>
<g class="fjs-boxplot-axis fjs-y-axis" ref="yAxis"></g> <g class="fjs-boxplot-axis fjs-y-axis" ref="yAxis"></g>
<g class="fjs-box" <g class="fjs-box"
:ref="`${label}-box`"
:transform="`translate(${scales.x(label)}, 0)`" :transform="`translate(${scales.x(label)}, 0)`"
v-tooltip="{placement: 'bottom'}" v-tooltip="{placement: 'bottom'}"
:title="label"
@click="setIDFilter(label)" @click="setIDFilter(label)"
@mouseenter="showTooltip(label)" @mouseenter="showTooltip(label)"
@mouseleave="hideTooltip(label)" @mouseleave="hideTooltip(label)"
v-for="label in labels"> v-for="label in labels">
<text text-anchor="middle"
:transform="`translate(${boxplotWidth / 1.8},${boxes[label].median})rotate(90)`">
{{label}}
</text>
<line class="fjs-upper-whisker" <line class="fjs-upper-whisker"
:ref="`${label}-upper-whisker`" :ref="`${label}-upper-whisker`"
:title="results.statistics[label].u_wsk" :title="results.statistics[label].u_wsk"
...@@ -137,7 +140,6 @@ ...@@ -137,7 +140,6 @@
import runAnalysis from '../../utils/run-analysis' import runAnalysis from '../../utils/run-analysis'
import * as d3 from 'd3' import * as d3 from 'd3'
import deepFreeze from 'deep-freeze-strict' import deepFreeze from 'deep-freeze-strict'
import { truncateTextUntil } from '../../utils/utils'
import tooltip from '../directives/tooltip' import tooltip from '../directives/tooltip'
import StateSaver from '../mixins/state-saver' import StateSaver from '../mixins/state-saver'
import getHDPICanvas from '../../utils/high-dpi-canvas' import getHDPICanvas from '../../utils/high-dpi-canvas'
...@@ -188,7 +190,7 @@ ...@@ -188,7 +190,7 @@
const left = 10 const left = 10
const top = this.height / 20 const top = this.height / 20
const right = this.width / 20 const right = this.width / 20
const bottom = this.height / 3 const bottom = 10
return { left, top, right, bottom } return { left, top, right, bottom }
}, },
padded () { padded () {
...@@ -289,18 +291,12 @@ ...@@ -289,18 +291,12 @@
}) })
return polyPoints return polyPoints
}, },
axis () { yAxis () {
const x = d3.axisBottom(this.scales.x).tickFormat(d => { return d3.axisRight(this.scales.y).tickSizeInner(this.padded.width)
// noinspection JSSuspiciousNameCombination
return truncateTextUntil({text: d, font: `0.875em Roboto`, maxWidth: this.margin.bottom})
})
const y = d3.axisRight(this.scales.y)
.tickSizeInner(this.padded.width)
return { x, y }
}, },
anova () { anova () {
let fValue = this.results.anova.f_value == null ? 'NaN' : this.results.anova.f_value.toFixed(4) let fValue = this.results.anova.f_value == null ? 'NaN' : this.results.anova.f_value.toPrecision(4)
let pValue = this.results.anova.p_value == null ? 'NaN' : this.results.anova.p_value.toFixed(4) let pValue = this.results.anova.p_value == null ? 'NaN' : this.results.anova.p_value.toPrecision(4)
return {pValue, fValue} return {pValue, fValue}
} }
}, },
...@@ -316,15 +312,10 @@ ...@@ -316,15 +312,10 @@
this.hasSetFilter = false this.hasSetFilter = false
} }
}, },
'axis': { 'yAxis': {
handler: function (newAxis) { handler: function (newAxis) {
this.$nextTick(() => { this.$nextTick(() => {
d3.select(this.$refs.xAxis) d3.select(this.$refs.yAxis).call(newAxis)
.call(newAxis.x)
.selectAll('text')
.attr('transform', 'rotate(20)')
d3.select(this.$refs.yAxis)
.call(newAxis.y)
}) })
} }
}, },
...@@ -469,9 +460,4 @@ ...@@ -469,9 +460,4 @@
stroke: #E2E2E2 stroke: #E2E2E2
path path
stroke: none stroke: none
.fjs-x-axis
.tick
text
text-anchor: start
font-size: 0.75em
</style> </style>
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
<html2svg :right="padded.width"> <html2svg :right="padded.width">
<draggable> <draggable>
<div class="fjs-legend"> <div class="fjs-legend">
<span>Corr. Coef.: {{ tmpResults.coef.toFixed(4) }}</span> <span>Corr. Coef.: {{ tmpResults.coef.toPrecision(4) }}</span>
<span>p-value: {{ tmpResults.p_value.toFixed(4) }}</span> <span>p-value: {{ tmpResults.p_value.toPrecision(4) }}</span>
<div v-for="(point, i) in legendSubsetPoints"> <div v-for="(point, i) in legendSubsetPoints">
<svg :width="pointSize * 2" :height="pointSize * 2"> <svg :width="pointSize * 2" :height="pointSize * 2">
<polygon :points="point"></polygon> <polygon :points="point"></polygon>
......
...@@ -16,14 +16,14 @@ ...@@ -16,14 +16,14 @@
<div> <div>
<label> <label>
<select v-model="pcX"> <select v-model="pcX">
<option :value="i" v-for="i in components">Principal Component {{i}}</option> <option :value="i" v-for="i in pcomponents">Principal Component {{i + 1}}</option>
</select> </select>
X-Axis X-Axis
</label> </label>
<br/> <br/>
<label> <label>
<select v-model="pcY"> <select v-model="pcY">
<option :value="i" v-for="i in components">Principal Component {{i}}</option> <option :value="i" v-for="i in pcomponents">Principal Component {{i + 1}}</option>
</select> </select>
Y-Axis Y-Axis
</label> </label>
...@@ -65,12 +65,12 @@ ...@@ -65,12 +65,12 @@
:y="- margin.top / 2" :y="- margin.top / 2"
text-anchor="middle" text-anchor="middle"
v-show="results.data.id.length"> v-show="results.data.id.length">
Principal Component {{pcX}} (Variance Ratio: {{ results.variance_ratios[pcX].toFixed(2) }}) Principal Component {{pcX + 1}} (Variance Ratio: {{ results.variance_ratios[pcX].toFixed(2) }})
</text> </text>
<text text-anchor="middle" <text text-anchor="middle"
:transform="`translate(${this.padded.width + this.margin.right / 2}, ${this.padded.height / 2})rotate(90)`" :transform="`translate(${this.padded.width + this.margin.right / 2}, ${this.padded.height / 2})rotate(90)`"
v-show="results.data.id.length"> v-show="results.data.id.length">
Principal Component {{pcY}} (Variance Ratio: {{ results.variance_ratios[pcY].toFixed(2) }}) Principal Component {{pcY + 1}} (Variance Ratio: {{ results.variance_ratios[pcY].toFixed(2) }})
</text> </text>
<g v-for="loading in loadings"> <g v-for="loading in loadings">
<line class="fjs-loadings" <line class="fjs-loadings"
...@@ -264,8 +264,8 @@ ...@@ -264,8 +264,8 @@
} }
}) })
}, },
components () { pcomponents () {
return Object.keys(this.results.loadings).filter(d => d !== 'feature') return Object.keys(this.results.loadings).filter(d => d !== 'feature').map(d => parseInt(d))
}, },
subsets () { subsets () {
return [...new Set(this.results.data.subset)] return [...new Set(this.results.data.subset)]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment