Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
24 changes: 24 additions & 0 deletions public/stage-1-covid/config-stage-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,29 @@
"leftLabel": "Not at all confident",
"rightLabel": "Extremely confident",
"numItems": 7
},
{
"id": "political-ideology",
"type": "likert",
"location": "belowStimulus",
"prompt": "In terms of your political views, do you think of yourself as:",
"required": true,
"leftLabel": "Very Liberal",
"rightLabel": "Very Conservative",
"numItems": 7
}
]
},
"attention-check": {
"type": "questionnaire",
"response": [
{
"id": "attention-bird",
"type": "shortText",
"location": "belowStimulus",
"prompt": "To show you are paying attention, please type the word 'bird' in the box below.",
"required": true,
"placeholder": "Type 'bird' here"
}
]
}
Expand Down Expand Up @@ -5225,6 +5248,7 @@
}
]
},
"attention-check",
"covid-metadata-task",
"post-study-quant"
]
Expand Down
24 changes: 24 additions & 0 deletions public/stage-1/config-stage-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,29 @@
"leftLabel": "Not at all confident",
"rightLabel": "Extremely confident",
"numItems": 7
},
{
"id": "political-ideology",
"type": "likert",
"location": "belowStimulus",
"prompt": "In terms of your political views, do you think of yourself as:",
"required": true,
"leftLabel": "Very Liberal",
"rightLabel": "Very Conservative",
"numItems": 7
}
]
},
"attention-check": {
"type": "questionnaire",
"response": [
{
"id": "attention-bird",
"type": "shortText",
"location": "belowStimulus",
"prompt": "To show you are paying attention, please type the word 'bird' in the box below.",
"required": true,
"placeholder": "Type 'bird' here"
}
]
}
Expand Down Expand Up @@ -5225,6 +5248,7 @@
}
]
},
"attention-check",
"stock-metadata-task",
"post-study-quant"
]
Expand Down
67 changes: 37 additions & 30 deletions src/public/viz-guardrails/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ export function LineChart({
let displayLabel = x.label;
if (dataname === 'sp500_stocks' && country) {
const longName = country.longName || country.name || baseName;
const trimmed = longName.length > 12 ? `${longName.slice(0, 12)}...` : longName;
const trimmed = longName.length > 17 ? `${longName.slice(0, 17)}...` : longName;
displayLabel = tail ? `${trimmed}\n${tail}` : trimmed;
tooltip = longName;
}
Expand Down Expand Up @@ -1557,36 +1557,43 @@ export function LineChart({
</>
)}
</svg>
{labelHtmlPositions.map((x) => (
<Tooltip
key={`label_html_${x.label}_${x.idx}`}
label={x.tooltip}
disabled={!x.tooltip}
position="right"
withArrow
withinPortal={false}
>
<span
style={{
position: 'absolute',
left: x.left + 2,
top: x.top - 8,
fontSize: 10,
color: x.color,
background: 'transparent',
cursor: x.tooltip ? 'pointer' : 'default',
whiteSpace: 'pre-line',
zIndex: 2,
userSelect: 'none',
padding: 0,
lineHeight: 1,
fontFamily: '"Helvetica Neue", "Helvetica", "Arial", sans-serif',
}}
{labelHtmlPositions.map((x) => {
const parts = x.label.split('\n');
const name = parts[0];
const tail = parts.slice(1).join('\n');
return (
<Tooltip
key={`label_html_${x.label}_${x.idx}`}
label={x.tooltip}
disabled={!x.tooltip}
position="right"
withArrow
withinPortal={false}
>
{`\u2002${x.label}`}
</span>
</Tooltip>
))}
<span
style={{
position: 'absolute',
left: x.left + 2,
top: x.top - 8,
fontSize: 10,
color: x.color,
background: 'transparent',
cursor: x.tooltip ? 'pointer' : 'default',
zIndex: 2,
userSelect: 'none',
padding: 0,
lineHeight: 1.1,
fontFamily: '"Helvetica Neue", "Helvetica", "Arial", sans-serif',
}}
>
<span style={{ whiteSpace: 'nowrap' }}>{`\u2002${name}`}</span>
{tail && (
<span style={{ display: 'block', whiteSpace: 'pre-line' }}>{tail}</span>
)}
</span>
</Tooltip>
);
})}
</div>
);
}
Expand Down
Loading