Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[electrophysiology_browser] Fix gap between chunks #8998

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,27 @@ import {colorOrder} from '../../color';

const LineMemo = R.memoizeWith(
({amplitudeScale, filters, channelIndex, traceIndex,
chunkIndex, isStacked, DCOffset, numChannels, numChunks}) =>
chunkIndex, isStacked, DCOffset, numChannels,
numChunks, previousPoint}) =>
`${amplitudeScale},${filters.join('-')},`
+ `${channelIndex}-${traceIndex}-${chunkIndex},`
+ `${isStacked},${DCOffset},${numChannels},${numChunks}`,
+ `${isStacked},${DCOffset},${numChannels},`
+ `${numChunks},${previousPoint}`,
({
channelIndex,
traceIndex,
chunkIndex,
interval,
seriesRange,
amplitudeScale,
filters,
values,
isStacked,
DCOffset,
numChannels,
numChunks,
...rest
channelIndex,
traceIndex,
chunkIndex,
interval,
seriesRange,
amplitudeScale,
filters,
values,
isStacked,
DCOffset,
numChannels,
numChunks,
previousPoint,
...rest
}) => {
const scales = [
scaleLinear()
Expand All @@ -36,12 +39,25 @@ const LineMemo = R.memoizeWith(
.range([-0.5, 0.5]),
];

const points = values.map((value, i) =>
vec2.fromValues(
scales[0](
interval[0] + (i / values.length) * (interval[1] - interval[0])
),
-(scales[1](value) - DCOffset)
const points = previousPoint === null
? []
: [
vec2.fromValues(
scales[0](
interval[0] - (1 / values.length) * (interval[1] - interval[0])
),
-(scales[1](previousPoint) - DCOffset)
)
];

points.push(
...values.map((value, i) =>
vec2.fromValues(
scales[0](
interval[0] + (i / values.length) * (interval[1] - interval[0])
),
-(scales[1](value) - DCOffset)
)
)
);

Expand Down Expand Up @@ -77,6 +93,7 @@ type CProps = {
withDCOffset: number,
numChannels: number,
numChunks: number,
previousPoint: number | null,
};

/**
Expand All @@ -95,22 +112,24 @@ type CProps = {
* @param root0.withDCOffset
* @param root0.numChannels
* @param root0.numChunks
* @param root0.previousPoint
*/
const LineChunk = ({
channelIndex,
traceIndex,
chunkIndex,
chunk,
seriesRange,
amplitudeScale,
scales,
physioFileID,
isHovered,
isStacked,
withDCOffset,
numChannels,
numChunks,
...rest
channelIndex,
traceIndex,
chunkIndex,
chunk,
seriesRange,
amplitudeScale,
scales,
physioFileID,
isHovered,
isStacked,
withDCOffset,
numChannels,
numChunks,
previousPoint,
...rest
}: CProps) => {
const {interval, values} = chunk;

Expand Down Expand Up @@ -151,6 +170,7 @@ const LineChunk = ({
DCOffset={withDCOffset}
numChannels={numChannels}
numChunks={numChunks}
previousPoint={previousPoint}
/>
</Group>
</Group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,8 @@ const SeriesRenderer: FunctionComponent<CProps> = ({
/>
</clipPath>

{channelList.map((channel, i) => {
{
channelList.map((channel, i) => {
if (!channelMetadata[channel.index]) {
return null;
}
Expand Down Expand Up @@ -733,12 +734,12 @@ const SeriesRenderer: FunctionComponent<CProps> = ({
: 0;

return (
trace.chunks.map((chunk, k) => (
trace.chunks.map((chunk, k, chunks) => (
<LineChunk
channelIndex={channel.index}
traceIndex={j}
chunkIndex={k}
key={`${k}-${trace.chunks.length}`}
key={`${channel.index}-${k}-${trace.chunks.length}`}
chunk={chunk}
seriesRange={seriesRange}
amplitudeScale={amplitudeScale}
Expand All @@ -749,6 +750,11 @@ const SeriesRenderer: FunctionComponent<CProps> = ({
withDCOffset={DCOffset}
numChannels={numDisplayedChannels}
numChunks={numChunks}
previousPoint={
k === 0
? null
: chunks[k - 1].values.slice(-1)[0]
}
/>
))
);
Expand Down
Loading