Skip to content

Commit 8ab4d5e

Browse files
author
minjk-bl
committed
Add show values precision option on Seaborn app
1 parent 08321ae commit 8ab4d5e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

html/m_visualize/seaborn.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
</div>
117117
<div class="vp-grid-box sb-option">
118118
<label><input type="checkbox" id="showValues" class="vp-state"/><span>Show values</span></label>
119+
<input type="number" id="showValuesPrecision" class="vp-state" placeholder="Type precision (0 ~ 5)" min="0" max="5"/>
119120
</div>
120121
</div>
121122
<label for="userOption" class="vp-bold">User Option</label>

js/m_visualize/Seaborn.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ define([
4949
kde: '',
5050
stat: '',
5151
showValues: false,
52+
showValuesPrecision: '',
5253
// axes options
5354
x_limit_from: '',
5455
x_limit_to: '',
@@ -705,7 +706,8 @@ define([
705706

706707
generateCode(preview=false) {
707708
let {
708-
chartType, data, x, y, setXY, hue, kde, stat, showValues, userOption='',
709+
chartType, data, x, y, setXY, hue, kde, stat, showValues, showValuesPrecision,
710+
userOption='',
709711
x_limit_from, x_limit_to, y_limit_from, y_limit_to,
710712
xticks, xticks_label, xticks_rotate, removeXticks,
711713
yticks, yticks_label, yticks_rotate, removeYticks,
@@ -851,7 +853,11 @@ define([
851853

852854
if (showValues && showValues === true) {
853855
code.appendLine('ax = ' + generatedCode);
854-
code.appendLine("vp_seaborn_show_values(ax)");
856+
code.append("vp_seaborn_show_values(ax");
857+
if (showValuesPrecision !== '') {
858+
code.appendFormat(", precision={0}", showValuesPrecision);
859+
}
860+
code.appendLine(")");
855861
} else {
856862
code.appendLine(generatedCode);
857863
}

0 commit comments

Comments
 (0)