Skip to content

Commit

Permalink
web/uplot: Don't show live values in Median app mode
Browse files Browse the repository at this point in the history
Without mouse hover this is not useful.

There seems to be no good way to detect if mouse hover is available
in general.
  • Loading branch information
photron committed Nov 6, 2024
1 parent d57ade7 commit ca1983e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
6 changes: 5 additions & 1 deletion software/web/main.scss.template
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,11 @@ body {
display: block;
}

.u-time-in-legend-alone .u-legend .u-marker {
.u-hide-marker-in-legend .u-legend .u-marker {
display: none;
}

.u-hide-empty-legend .u-legend tbody:empty {
display: none;
}

Expand Down
10 changes: 5 additions & 5 deletions software/web/src/modules/em_energy_analysis/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ export class EMEnergyAnalysisStatus extends Component<{}, EMEnergyAnalysisStatus
legend_time_label={__("em_energy_analysis.script.time_5min")}
legend_time_with_minutes={true}
aspect_ratio={3}
x_height={30}
x_height={35}
x_format={{hour: '2-digit', minute: '2-digit'}}
x_padding_factor={0}
x_include_date={false}
Expand Down Expand Up @@ -2367,7 +2367,7 @@ export class EMEnergyAnalysis extends Component<EMEnergyAnalysisProps, EMEnergyA
legend_time_with_minutes={true}
legend_div_ref={this.uplot_legend_div_5min_power_ref}
aspect_ratio={3}
x_height={30}
x_height={35}
x_format={{hour: '2-digit', minute: '2-digit'}}
x_padding_factor={0}
x_include_date={false}
Expand All @@ -2387,8 +2387,8 @@ export class EMEnergyAnalysis extends Component<EMEnergyAnalysisProps, EMEnergyA
y2_skip_upper={true}
padding={[0, 5, null, null]}/>
<div class="pb-4">
<div class="uplot u-hz u-time-in-legend-alone" ref={this.uplot_legend_div_5min_flags_ref} style="width: 100%; visibility: hidden;" />
<div class="uplot u-hz u-hide-first-series-in-legend" ref={this.uplot_legend_div_5min_power_ref} style="width: 100%; visibility: hidden;" />
<div class={"uplot u-hz" + (util.is_native_median_app() ? "" : " u-time-in-legend-alone") + " u-hide-marker-in-legend u-hide-empty-legend"} ref={this.uplot_legend_div_5min_flags_ref} style="width: 100%; visibility: hidden;" />
<div class={"uplot u-hz" + (util.is_native_median_app() ? "" : " u-hide-first-series-in-legend")} ref={this.uplot_legend_div_5min_power_ref} style="width: 100%; visibility: hidden;" />
</div>
</UplotLoader>
<UplotLoader ref={this.uplot_loader_daily_ref}
Expand All @@ -2405,7 +2405,7 @@ export class EMEnergyAnalysis extends Component<EMEnergyAnalysisProps, EMEnergyA
legend_time_label={__("em_energy_analysis.script.time_daily")}
legend_time_with_minutes={false}
aspect_ratio={3}
x_height={30}
x_height={35}
x_format={{month: '2-digit', day: '2-digit'}}
x_padding_factor={0.015}
x_include_date={false}
Expand Down
2 changes: 1 addition & 1 deletion software/web/src/modules/meters/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ export class Meters extends ConfigComponent<'meters/0/config', MetersProps, Mete
legend_time_label={__("meters.script.time")}
legend_time_with_seconds={true}
aspect_ratio={3}
x_height={30}
x_height={35}
x_format={{hour: '2-digit', minute: '2-digit'}}
x_padding_factor={0}
x_include_date={false}
Expand Down
1 change: 1 addition & 0 deletions software/web/src/ts/components/uplot_wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ export class UplotWrapper extends Component<UplotWrapperProps, {}> {
},
},
legend: {
live: !util.is_native_median_app(),
mount: (self: uPlot, legend: HTMLElement) => {
if (this.props.legend_div_ref && this.props.legend_div_ref.current) {
this.props.legend_div_ref.current.appendChild(legend);
Expand Down
1 change: 1 addition & 0 deletions software/web/src/ts/components/uplot_wrapper_2nd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export class UplotWrapper extends Component<UplotWrapperProps, {}> {
},
},
legend: {
live: !util.is_native_median_app(),
mount: (self: uPlot, legend: HTMLElement) => {
if (this.props.legend_div_ref && this.props.legend_div_ref.current) {
this.props.legend_div_ref.current.appendChild(legend);
Expand Down
3 changes: 2 additions & 1 deletion software/web/src/ts/components/uplot_wrapper_3rd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ export class UplotFlagsWrapper extends Component<UplotFlagsWrapperProps, {}> {
},
},
},
padding: [null, 5, 0, null],
legend: {
live: !util.is_native_median_app(),
mount: (self: uPlot, legend: HTMLElement) => {
if (this.props.legend_div_ref && this.props.legend_div_ref.current) {
this.props.legend_div_ref.current.appendChild(legend);
}
},
},
padding: [null, 5, 0, null],
plugins: [
uPlotTimelinePlugin({
fill: (seriesIdx: number, dataIdx: number, value: any) => this.data.value_fills && this.data.value_fills[seriesIdx] ? this.data.value_fills[seriesIdx][value] : 'rgb(0, 0, 0, 0.1)',
Expand Down

0 comments on commit ca1983e

Please sign in to comment.