Skip to content

Commit ef51bc4

Browse files
authored
cleanup: set style using CSS (#2666)
Setting the style manually generally is not recommended as it can contain JavaScript invoking CSS.
1 parent 1b92b44 commit ef51bc4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tensorboard/components/tf_line_chart_data_loader/tf-line-chart-data-loader.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<div id="chart-and-spinner-container">
3232
<vz-line-chart2
3333
id="chart"
34+
data-loading$="[[dataLoading]]"
3435
color-scale="[[colorScale]]"
3536
default-x-range="[[defaultXRange]]"
3637
default-y-range="[[defaultYRange]]"
@@ -39,7 +40,6 @@
3940
on-chart-attached="_onChartAttached"
4041
smoothing-enabled="[[smoothingEnabled]]"
4142
smoothing-weight="[[smoothingWeight]]"
42-
style="[[_computeLineChartStyle(dataLoading)]]"
4343
symbol-function="[[symbolFunction]]"
4444
tooltip-columns="[[tooltipColumns]]"
4545
tooltip-position="[[tooltipPosition]]"
@@ -85,10 +85,14 @@
8585
top: 0;
8686
}
8787

88-
vz-line-chart {
88+
vz-line-chart2 {
8989
-webkit-user-select: none;
9090
-moz-user-select: none;
9191
}
92+
93+
vz-line-chart2[data-loading] {
94+
opacity: 0.3;
95+
}
9296
</style>
9397
</template>
9498
<script src="../vz-line-chart2/line-chart-exporter.js"></script>
@@ -244,10 +248,6 @@
244248
this.redraw();
245249
},
246250

247-
_computeLineChartStyle(loading) {
248-
return loading ? 'opacity: 0.3;' : '';
249-
},
250-
251251
_fixBadStateWhenActive() {
252252
// When the chart enters a potentially bad state (because it should
253253
// redraw, but the page is not currently active), we set the

0 commit comments

Comments
 (0)