Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ```dataviewjs
- const rawData = await dv.query('TABLE WITHOUT ID file.name, G.distanz, G.dauer FROM "10 - Daily Notes" WHERE sport AND (contains(sport.type, "Gehen") OR contains(sport.type, "Laufen")) FLATTEN sport.gehen AS G SORT file.name DESC');
- const rows = rawData.value.values;
- const chartData = {
- data: {
- labels: rows.map(x => x[0]),
- datasets: [{
- type: 'bar',
- label: 'km',
- data: rows.map(x => x[1]),
- barThickness: 3,
- pointStyle: 'cross',
- backgroundColor: ['#478FEE'],
- borderWidth: 1,
- borderColor: ['#478FEE'],
- fill: false,
- xAxisID: 'x2'
- },
- {
- type: 'bar',
- label: 'Minuten',
- data: rows.map(x => x[2]),
- barThickness: 3,
- backgroundColor: ['#44475a'],
- borderWidth: 0,
- borderColor: ['#44475a'],
- fill: false,
- xAxisID: 'x1',
- },
- ],
- },
- options: {
- responsive: true,
- animations: true,
- indexAxis: 'y',
- plugins: {
- legend: {
- display: true,
- position: 'bottom',
- },
- },
- scales: {
- x1: {
- type: 'linear',
- display: true,
- position: 'top',
- },
- x2: {
- type: 'linear',
- display: true,
- position: 'bottom',
- },
- },
- },
- }
- // this.container.style.width = "80%";
- // this.container.style.margin = "auto";
- window.renderChart(chartData, this.container);
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement