@@ -230,10 +230,6 @@ const DEFAULT_CHAR_WIDTH = 7; | |||||
const ANGLE_RATIO = Math.PI / 180; | const ANGLE_RATIO = Math.PI / 180; | ||||
const FULL_ANGLE = 360; | const FULL_ANGLE = 360; | ||||
/** | |||||
* Returns the value of a number upto 2 decimal places. | |||||
* @param {Number} d Any number | |||||
*/ | |||||
function floatTwo(d) { | function floatTwo(d) { | ||||
return parseFloat(d.toFixed(2)); | return parseFloat(d.toFixed(2)); | ||||
} | } | ||||
@@ -1410,6 +1406,14 @@ class BaseChart { | |||||
onDownArrow() {} | onDownArrow() {} | ||||
onEnterKey() {} | onEnterKey() {} | ||||
addDataPoint() {} | |||||
removeDataPoint() {} | |||||
getDataPoint() {} | |||||
setCurrentDataPoint() {} | |||||
updateDataset() {} | |||||
getDifferentChart(type) { | getDifferentChart(type) { | ||||
return getDifferentChart(type, this.type, this.parent, this.rawChartArgs); | return getDifferentChart(type, this.type, this.parent, this.rawChartArgs); | ||||
} | } | ||||
@@ -3132,10 +3136,10 @@ class AxisChart extends BaseChart { | |||||
// Render overlays | // Render overlays | ||||
this.overlayGuides.map(d => { | this.overlayGuides.map(d => { | ||||
let currentUnit = d.units[this.state.currentIndex]; | let currentUnit = d.units[this.state.currentIndex]; | ||||
d.overlay = makeOverlay[d.type](currentUnit); | d.overlay = makeOverlay[d.type](currentUnit); | ||||
this.drawArea.appendChild(d.overlay); | this.drawArea.appendChild(d.overlay); | ||||
}); | }); | ||||
} | } | ||||
updateOverlayGuides() { | updateOverlayGuides() { | ||||
@@ -3248,7 +3252,6 @@ class AxisChart extends BaseChart { | |||||
// removeDataPoint(index = 0) {} | // removeDataPoint(index = 0) {} | ||||
} | } | ||||
// import MultiAxisChart from './charts/MultiAxisChart'; | |||||
const chartTypes = { | const chartTypes = { | ||||
// multiaxis: MultiAxisChart, | // multiaxis: MultiAxisChart, | ||||
percentage: PercentageChart, | percentage: PercentageChart, | ||||
@@ -447,7 +447,7 @@ for (var i = 0; i< 375; i++) { | |||||
timestamp = Math.floor(timestamp - 86400).toFixed(1); | timestamp = Math.floor(timestamp - 86400).toFixed(1); | ||||
} | } | ||||
new Chart("#chart-heatmap", { | |||||
let heatmap = new Chart("#chart-heatmap", { | |||||
data: heatmapData, | data: heatmapData, | ||||
type: 'heatmap', | type: 'heatmap', | ||||
legendScale: [0, 1, 2, 4, 5], | legendScale: [0, 1, 2, 4, 5], | ||||
@@ -456,6 +456,8 @@ new Chart("#chart-heatmap", { | |||||
legendColors: ['#ebedf0', '#fdf436', '#ffc700', '#ff9100', '#06001c'] | legendColors: ['#ebedf0', '#fdf436', '#ffc700', '#ff9100', '#06001c'] | ||||
}); | }); | ||||
// console.log(heatmapData, heatmap); | |||||
Array.prototype.slice.call( | Array.prototype.slice.call( | ||||
document.querySelectorAll('.heatmap-mode-buttons button') | document.querySelectorAll('.heatmap-mode-buttons button') | ||||
).map(el => { | ).map(el => { | ||||
@@ -191,8 +191,7 @@ | |||||
<button type="button" class="btn btn-sm btn-secondary" data-color="default">Default green</button> | <button type="button" class="btn btn-sm btn-secondary" data-color="default">Default green</button> | ||||
<button type="button" class="btn btn-sm btn-secondary active" data-color="halloween">GitHub's Halloween</button> | <button type="button" class="btn btn-sm btn-secondary active" data-color="halloween">GitHub's Halloween</button> | ||||
</div> | </div> | ||||
<pre><code class="hljs javascript margin-vertical-px"> let heatmap = new Chart({ | |||||
parent: "#heatmap", | |||||
<pre><code class="hljs javascript margin-vertical-px"> let heatmap = new Chart("#heatmap", { | |||||
type: 'heatmap', | type: 'heatmap', | ||||
height: 115, | height: 115, | ||||
data: heatmapData, // object with date/timestamp-value pairs | data: heatmapData, // object with date/timestamp-value pairs | ||||
@@ -439,10 +439,10 @@ export default class AxisChart extends BaseChart { | |||||
// Render overlays | // Render overlays | ||||
this.overlayGuides.map(d => { | this.overlayGuides.map(d => { | ||||
let currentUnit = d.units[this.state.currentIndex]; | let currentUnit = d.units[this.state.currentIndex]; | ||||
d.overlay = makeOverlay[d.type](currentUnit); | d.overlay = makeOverlay[d.type](currentUnit); | ||||
this.drawArea.appendChild(d.overlay); | this.drawArea.appendChild(d.overlay); | ||||
}); | }); | ||||
} | } | ||||
updateOverlayGuides() { | updateOverlayGuides() { | ||||
@@ -268,6 +268,14 @@ export default class BaseChart { | |||||
onDownArrow() {} | onDownArrow() {} | ||||
onEnterKey() {} | onEnterKey() {} | ||||
addDataPoint() {} | |||||
removeDataPoint() {} | |||||
getDataPoint() {} | |||||
setCurrentDataPoint() {} | |||||
updateDataset() {} | |||||
getDifferentChart(type) { | getDifferentChart(type) { | ||||
return getDifferentChart(type, this.type, this.parent, this.rawChartArgs); | return getDifferentChart(type, this.type, this.parent, this.rawChartArgs); | ||||
} | } | ||||