Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xvaara committed Mar 20, 2023
1 parent a176fae commit 0126859
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,15 @@ while (i < limit) {
function addSeries() {
// console.log('addSeries')
options.value.series.push({ label: `s${options.value.series.length}`, stroke: `#${Math.floor(Math.random() * 16777215).toString(16)}` })
const newSeries = { label: `s${options.value.series.length}`, stroke: `#${Math.floor(Math.random() * 16777215).toString(16)}` }
options.value.series.push(newSeries)
noZoomOptions.value.series.push(newSeries)
let foo = (Math.random() - 0.5) * 100
// @ts-expect-error don't know how to fix this
data.value.push(data.value[1].map(() => {
foo = foo + (Math.random() - 0.5) * 10
return foo
}))
newData()
}
setInterval(() => {
newData()
Expand Down Expand Up @@ -124,7 +125,15 @@ const thePlot = ref(null as unknown as UplotElement)
</div>
</div>
<div class="col border" style="min-height: 400px;">
<Uplot ref="thePlot" v-model:series="myseries" :options="noZoomOptions" :data="data" reset-scale @cursor="cursor = $event" @select="select = $event" />
<Uplot
ref="thePlot"
v-model:series="myseries"
:options="noZoomOptions"
:data="data"
reset-scale
no-footer
@cursor="cursor = $event" @select="select = $event"
/>
</div>
</div>
<div class="row">
Expand Down
2 changes: 1 addition & 1 deletion src/components/uplot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ defineExpose({ toggleShow, uplot })
<br>
<pre style="text-align: left;">{{ series }}</pre>
</div>
<slot name="footer" :series="series" :toggle-show="toggleShow">
<slot v-if="!noFooter" name="footer" :series="series" :toggle-show="toggleShow">
<div class="__uplot-legend">
<div v-for="(s, i) in series" :key="s.label" class="__uplot-legend-series" :class="[`__uplot-${s.label?.toLowerCase()}`, `__uplot-i-${i}`]" :style="{ backgroundColor: s.show ? '' : 'lightgrey' }" @click="toggleShow(i)">
<span v-if="i !== 0" :style="{ color: s.stroke || 'black' }" class="__uplot-legend-label">{{ s.label }}</span>
Expand Down

0 comments on commit 0126859

Please sign in to comment.