Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: heatmap/swimlane chart type #831

Merged
merged 54 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
cfd10b8
feat: add heatmap boilerplate
markov00 Aug 10, 2020
b7fdb06
WIP legend
darnautov Aug 30, 2020
f8ab8de
feat: hidden items in legend
darnautov Sep 1, 2020
5e16286
highlight brush selection
darnautov Sep 8, 2020
74c691e
feat: support threshold scale type
darnautov Sep 15, 2020
af6a06b
feat: grid rendering
darnautov Sep 15, 2020
5fc4e78
feat: init brush for heatmap
darnautov Sep 16, 2020
b2586ab
feat: support brushing outside of chart
darnautov Sep 16, 2020
5fba938
feat: support xDomain with custom interval
darnautov Sep 18, 2020
5e468d9
feat: WIP axis rendering with overflow, measure chart dimensions
darnautov Sep 22, 2020
289ed74
feat: fix brush area selector
darnautov Sep 22, 2020
eb8055f
feat: tooltip for Y axis values
darnautov Sep 22, 2020
d1125c3
feat: fix pickDragShape
darnautov Sep 22, 2020
483aa99
feat: fix pickDragArea
darnautov Sep 22, 2020
5c87e27
fix: breaking change in patch release of 21.1.1
nickofthyme Sep 22, 2020
d41737a
feat: refactor using mergeXDomain
darnautov Sep 23, 2020
5c886f6
fix: scale types
darnautov Sep 23, 2020
2de90e1
fix: typescript issues
darnautov Sep 23, 2020
2b664ab
fix: pick shapes
darnautov Sep 23, 2020
60f9245
fix: add internal annotations
darnautov Sep 23, 2020
56f0925
fix: update charts.api.md
darnautov Sep 23, 2020
1ba0a69
fix: add brush selectors
markov00 Sep 23, 2020
6bacea7
feat: highlighted area
darnautov Sep 28, 2020
027af7a
fix: createOnBrushEndCaller, pickDragArea
darnautov Sep 29, 2020
169c696
fix: time scale alignment, VRTs and brush type
markov00 Sep 29, 2020
ac16c3d
fix: highlighter as a mask
darnautov Sep 29, 2020
736a6d9
fix: x axis right overflow
markov00 Sep 29, 2020
c7c39d4
fix: align y axis labels to the right
markov00 Sep 29, 2020
63122ea
feat: add fixed width left axis
markov00 Sep 29, 2020
998889d
fix: highlighter without memoizing
markov00 Sep 29, 2020
d9b8c06
feat: expose label formatter and fix categorical x label position
markov00 Sep 29, 2020
8ad24c5
feat: render border around the drag area
darnautov Sep 29, 2020
1f1eef4
fix: pickDragShape based on the gird metrics
darnautov Sep 30, 2020
dab0347
feat: better time range resolving
darnautov Sep 30, 2020
c22ffc8
fix HeatmapBrushEvent type
darnautov Sep 30, 2020
2b0ec15
fix: change ticks amount based on the chart width
darnautov Oct 1, 2020
ddf7859
fix: types
darnautov Oct 1, 2020
58e64ff
feat: prop accessors support
darnautov Oct 1, 2020
1bf2622
feat: brushArea, brushMask, brushTool configs
darnautov Oct 1, 2020
78a7680
feat: timeZone config
darnautov Oct 1, 2020
9cd0464
fix: api check
darnautov Oct 1, 2020
575e853
Merge remote-tracking branch 'upstream/master' into swimlane-heatmap-…
darnautov Oct 1, 2020
bba4d87
feat: onBrushEnd as part of a heatmap config
darnautov Oct 1, 2020
6ff2116
fix: brush behaviour within area
markov00 Oct 1, 2020
c0c37c8
feat: add ticks to the colorScale
darnautov Oct 1, 2020
0b4b623
fix: remove a chartType prop from XYBrushArea
darnautov Oct 1, 2020
940b98a
fix: charts.api.md
darnautov Oct 1, 2020
0af6a9a
feat: deselect cells from legend
markov00 Oct 1, 2020
ce38069
feat: getPointerCursorSelector
darnautov Oct 1, 2020
fbdc7ec
feat: jsDoc links to d3-scale
darnautov Oct 1, 2020
b0df4d6
test: update VRTs baseline
markov00 Oct 1, 2020
e49096b
refactor: remove d3 documentation links
markov00 Oct 1, 2020
9d77fdd
Merge remote-tracking branch 'upstream/master' into swimlane-heatmap-…
darnautov Oct 2, 2020
893efb1
fix: return the cells on brush end
markov00 Oct 2, 2020
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
35 changes: 28 additions & 7 deletions .playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,38 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<style>
html,
body,
#root {
body {
background: blanchedalmond !important;
width: 100%;
height: 100%;
padding: 10px;
overflow: hidden;
}

.chart {
position: relative;
background: white;
width: 800px;
height: 500px;
/*display: inline-block;
position: relative;
*/
width: 100%;
height: 100%;
overflow: auto;
}

.testing {
background: aquamarine;
position: relative;
width: 100%;
overflow: auto;
}

.page {
padding: 10px;
width: 100%;
height: 100%;
}
#root {
height: 100%;
wwidth: 100%;
}

label {
Expand All @@ -29,7 +48,9 @@
</head>

<body>
<div id="root"></div>
<div class="page">
<div id="root"></div>
</div>
<script src="bundle.js" type="text/javascript"></script>
</body>
</html>
160 changes: 152 additions & 8 deletions .playground/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,159 @@
* specific language governing permissions and limitations
* under the License.
*/

/* eslint-disable no-console */
import React from 'react';

import { Example } from '../stories/bar/1_basic';
import { Chart, Heatmap, HeatmapConfig, RecursivePartial, ScaleType, Settings } from '../src';
import { HeatmapSpec } from '../src/chart_types/heatmap/specs';
import { BABYNAME_DATA } from '../src/utils/data_samples/babynames';
import { SWIM_LANE_DATA } from '../src/utils/data_samples/test_anomaly_swim_lane';

export class Playground extends React.Component<any, { highlightedData?: HeatmapSpec['highlightedData'] }> {
constructor(props: any) {
super(props);
this.state = {
highlightedData: {
x: [1572908400000, 1572910200000],
y: ['i-ca80c01a'],
},
};
}

onBrushEnd: HeatmapConfig['onBrushEnd'] = (e) => {
console.log('___onBrushEnd___', e);
this.setState({
highlightedData: { x: e.x as any[], y: e.y as any[] },
});
};

export function Playground() {
return (
<div className="chart">
<Example />
</div>
);
render() {
const heatmapConfig: RecursivePartial<HeatmapConfig> = {
grid: {
cellHeight: {
min: 20,
max: 20, // 'fill',
},
stroke: {
width: 1,
color: '#D3DAE6',
},
},
cell: {
maxWidth: 'fill',
maxHeight: 'fill',
label: {
visible: false,
},
border: {
stroke: '#D3DAE6',
strokeWidth: 0,
},
},
brushArea: {
fill: 'red',
},
yAxisLabel: {
visible: true,
width: { max: 50 },
padding: 5,
fill: '#6a717d',
},
xAxisLabel: {
fill: '#6a717d',
},
onBrushEnd: this.onBrushEnd,
};
console.log(
BABYNAME_DATA.filter(([year]) => year > 1950).map((d) => {
return [d[0], d[1], d[2], -d[3]];
}),
);
return (
<div>
<div className="chart" style={{ height: '500px', overflow: 'auto' }}>
<Chart>
<Settings
onElementClick={console.log}
showLegend
legendPosition="top"
brushAxis="both"
xDomain={{ min: 1572825600000, max: 1572912000000, minInterval: 1800000 }}
/>
<Heatmap
id="heatmap1"
ranges={[0, 3, 25, 50, 75]}
colorScale={ScaleType.Threshold}
colors={['#ffffff', '#d2e9f7', '#8bc8fb', '#fdec25', '#fba740', '#fe5050']}
data={SWIM_LANE_DATA.map((v) => ({ ...v, time: v.time * 1000 }))}
highlightedData={this.state.highlightedData}
xAccessor="time"
yAccessor={(d) => d.laneLabel}
valueAccessor="value"
valueFormatter={(d) => d.toFixed(0.2)}
ySortPredicate="numAsc"
xScaleType={ScaleType.Time}
config={heatmapConfig}
/>
</Chart>
</div>
<br />
<div className="chart" style={{ height: '500px' }}>
<Chart>
<Settings
onElementClick={console.log}
showLegend
legendPosition="left"
onBrushEnd={console.log}
brushAxis="both"
/>
<Heatmap
id="heatmap2"
colorScale={ScaleType.Linear}
colors={['yellow', 'red']}
data={
BABYNAME_DATA.filter(([year]) => year > 1950)
// .map((d, i) => {
// return [d[0], d[1], d[2], d[3] > 20000 ? -d[3] : d[3]];
// })
}
xAccessor={(d) => d[2]}
yAccessor={(d) => d[0]}
valueAccessor={(d) => d[3]}
valueFormatter={(value) => value.toFixed(0.2)}
xSortPredicate="alphaAsc"
config={{
grid: {
cellHeight: {
min: 40,
max: 40, // 'fill',
},
stroke: {
width: 0,
},
},
cell: {
maxWidth: 'fill',
maxHeight: 20,
label: {
visible: true,
},
border: {
stroke: 'white',
strokeWidth: 1,
},
},
yAxisLabel: {
visible: true,
width: 'auto',
textColor: '#6a717d',
},
}}
/>
</Chart>
</div>
</div>
);
}
}
/* eslint-enable no-console */
Loading