Skip to content

Commit 63118cf

Browse files
committed
examples: web-analytics update
* Partion SessionUsers pre-agg * Fix table align * Add favicon * Add link to github to the header
1 parent 8fd7876 commit 63118cf

File tree

14 files changed

+81
-77
lines changed

14 files changed

+81
-77
lines changed
10.4 KB
Loading
31.7 KB
Loading
7.27 KB
Loading
1.17 KB
Loading
1.9 KB
Loading
11 KB
Binary file not shown.

examples/web-analytics/dashboard-app/public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<meta name="theme-color" content="#000000" />
88
<meta
99
name="description"
10-
content="Open Source Web Analytics"
10+
content="Cube.js Web Analytics Template"
1111
/>
1212
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1313
<!--
@@ -24,7 +24,7 @@
2424
work correctly both with client-side routing and a non-root public URL.
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
27-
<title>React App</title>
27+
<title>Cube.js Web Analytics Template</title>
2828
</head>
2929
<body>
3030
<noscript>You need to enable JavaScript to run this app.</noscript>

examples/web-analytics/dashboard-app/public/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"short_name": "React App",
3-
"name": "Create React App Sample",
2+
"short_name": "Web Analytics",
3+
"name": "Cube,js Web Analytics Template",
44
"icons": [
55
{
66
"src": "favicon.ico",
7.13 KB
Loading

examples/web-analytics/dashboard-app/src/components/ChartRenderer.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const xAxisFormatter = (item) => {
5353
}
5454
}
5555

56+
const getType = (resultSet, key) => (resultSet.loadResponse.annotation.measures[key] || resultSet.loadResponse.annotation.dimensions[key]).type
57+
5658
const CartesianChart = ({ resultSet, legend, children, ChartComponent, height }) => (
5759
<ResponsiveContainer width="100%" height={height || 250}>
5860
<ChartComponent
@@ -186,16 +188,16 @@ const TypeToChartComponent = {
186188
<TableHead>
187189
<TableRow>
188190
{resultSet.tableColumns().map(c => (
189-
<TableCell key={c.key}>{c.shortTitle}</TableCell>
191+
<TableCell align={getType(resultSet, c.key) === 'number' ? 'right' : 'left'} key={c.key}>{c.shortTitle}</TableCell>
190192
))}
191193
</TableRow>
192194
</TableHead>
193195
<TableBody>
194196
{resultSet.tablePivot().map((row, index) => (
195197
<TableRow key={index}>
196198
{resultSet.tableColumns().map(c => {
197-
const type = (resultSet.loadResponse.annotation.measures[c.key] || resultSet.loadResponse.annotation.dimensions[c.key]).type
198-
return (<TableCell align={type === 'number' ? 'right' : 'left'} key={c.key}>{resolveFormatter(type)(row[c.key])}</TableCell>)
199+
const type = getType(resultSet, c.key);
200+
return (<TableCell align={getType(resultSet, c.key) === 'number' ? 'right' : 'left'} key={c.key}>{resolveFormatter(type)(row[c.key])}</TableCell>)
199201
})}
200202
</TableRow>
201203
))}

0 commit comments

Comments
 (0)