Skip to content

Commit a5cf2cf

Browse files
committed
Improved visualization
1 parent c75af89 commit a5cf2cf

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

packages/collaboration-extension/src/collaboration.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ export const rtcPanelPlugin: JupyterFrontEndPlugin<void> = {
194194
app.shell.add(chatPanel, 'left', { rank: 301 });
195195

196196
const chatbox = new Chatbox(user, awarenessProvider, roles);
197-
198197
chatbox.title.label = trans.__('Chat with collaborators');
199198
chatPanel.addWidget(chatbox);
200199

201-
const pollTab = new PollList(user, awarenessProvider, roles);
202-
203-
pollTab.title.label = trans.__('Polls');
204-
chatPanel.addWidget(pollTab);
200+
setTimeout(() => {
201+
const pollTab = new PollList(user, awarenessProvider, roles);
202+
pollTab.title.label = trans.__('Polls');
203+
chatPanel.addWidget(pollTab);
204+
}, 1000);
205205

206206
}
207207
};

packages/collaboration/src/activitydotplot.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const ActivityDotPlot: React.FC<ActivityDisplayComponentProps> = ({tracke
1414

1515
const [state, setState] = React.useState<SimpleUser[][]>([]);
1616

17+
const MIN_HORIZONTAL_RANGE = 20;
18+
1719
React.useEffect(() => {
1820

1921
const updateCounts = (notebook: Notebook) => {
@@ -59,17 +61,17 @@ export const ActivityDotPlot: React.FC<ActivityDisplayComponentProps> = ({tracke
5961
state.forEach((userArray, cellIndex) => {
6062

6163
userArray.forEach((user, userIndex) => {
62-
yValues.push(-cellIndex);
64+
yValues.push(-cellIndex - 1);
6365
xValues.push(userIndex + 1);
6466
hoverText.push(`${user.name} on cell ${cellIndex}`);
6567
});
6668

6769
});
6870

6971
const maxCellIndex = state.length > 0 ? state.length - 1 : 0
70-
const tickvals = Array.from(Array(maxCellIndex + 1).keys()).map(index => -index);
71-
const ticktext = Array.from(Array(maxCellIndex + 1).keys()).map(index => index.toString());
72-
72+
const tickvals = Array.from(Array(maxCellIndex + 2).keys()).map(index => -index);
73+
const ticktext = Array.from(Array(maxCellIndex + 2).keys()).map(index => (index - 1).toString());
74+
const maxXvalue = Math.max(...xValues, MIN_HORIZONTAL_RANGE);
7375

7476
const data = [{
7577
y: yValues,
@@ -87,12 +89,12 @@ export const ActivityDotPlot: React.FC<ActivityDisplayComponentProps> = ({tracke
8789
height: 500,
8890
xaxis: {
8991
title: 'Active users',
90-
range: [1, Math.max(...xValues) + 1]
92+
range: [0.5, maxXvalue]
9193
},
9294
yaxis: {
9395
title: 'Cell',
9496
autorange: false,
95-
range: [-maxCellIndex, 0],
97+
range: [-maxCellIndex - 1.5, -0.5],
9698
tickvals: tickvals,
9799
ticktext: ticktext
98100
},

0 commit comments

Comments
 (0)