"...dockerimages/AlpineLinuxPhpNginx.git" did not exist on "e3eca896de9a0a19b5e831cacd4a74044f244bd4"
Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import React from 'react'
import { scaleOrdinal } from '@visx/scale'
import { LegendOrdinal, LegendItem, LegendLabel } from '@visx/legend'
const data = [
'Universitetet i Bergen',
'Havforskningsinstituttet',
'Alfred Wegner Institute - Helmholz Centre for Polar Marine Research / Helmholz Association',
'Norges Arktiske Universitet, UiT',
'Bjerknessenteret for klimaforskning',
'Norsk Polarinstitutt',
'Russian Academy of Sciences',
'Universitetet I Oslo',
'UNIS - The University Centre in Svalbard',
'University of Alaska',
'Woods Hole Oceanographic Institution',
'Centre National de la Recherche Scientifique, CNRS',
]
const ordinalColorScale = scaleOrdinal({
domain: data,
range: ['#66d981', '#71f5ef', '#4899f1', '#7d81f6'],
})
const legendGlyphSize = 15
export default function Example({ events = false }: { events?: boolean }) {
return (
<div className="legends">
<LegendDemo title="Ordinal">
<LegendOrdinal scale={ordinalColorScale} labelFormat={(label) => `${label.toUpperCase()}`}>
{(labels) => (
<div style={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap' }}>
{labels.map((label, i) => (
<LegendItem
key={`legend-quantile-${i}`}
margin="0 5px"
onClick={() => {
if (events) alert(`clicked: ${JSON.stringify(label)}`)
}}
>
<svg width={legendGlyphSize} height={legendGlyphSize}>
<rect fill={label.value} width={legendGlyphSize} height={legendGlyphSize} />
</svg>
<LegendLabel align="left" margin="0 0 0 4px">
{label.text}
</LegendLabel>
</LegendItem>
))}
</div>
)}
</LegendOrdinal>
</LegendDemo>
<style jsx>{`
.legends {
font-family: arial;
font-weight: 900;
background-color: black;
border-radius: 14px;
padding: 24px 24px 24px 32px;
overflow-y: auto;
flex-grow: 1;
}
.chart h2 {
margin-left: 10px;
}
`}</style>
</div>
)
}
function LegendDemo({ title, children }: { title: string; children: React.ReactNode }) {
return (
<div className="legend">
<div className="title">{title}</div>
{children}
<style jsx>{`
.legend {
line-height: 0.9em;
color: #efefef;
font-size: 10px;
font-family: arial;
padding: 10px 10px;
float: left;
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 8px;
margin: 5px 5px;
}
.title {
font-size: 12px;
margin-bottom: 10px;
font-weight: 100;
}
`}</style>
</div>
)
}