|
|
@@ -2,8 +2,6 @@ function $(expr, con) { |
|
|
|
return typeof expr === "string"? (con || document).querySelector(expr) : expr || null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.create = (tag, o) => { |
|
|
|
var element = document.createElement(tag); |
|
|
|
|
|
|
@@ -66,10 +64,6 @@ function getElementContentWidth(element) { |
|
|
|
return element.clientWidth - padding; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fire(target, type, properties) { |
|
|
|
var evt = document.createEvent("HTMLEvents"); |
|
|
|
|
|
|
@@ -82,8 +76,6 @@ function fire(target, type, properties) { |
|
|
|
return target.dispatchEvent(evt); |
|
|
|
} |
|
|
|
|
|
|
|
// https://css-tricks.com/snippets/javascript/loop-queryselectorall-matches/ |
|
|
|
|
|
|
|
const BASE_MEASURES = { |
|
|
|
margins: { |
|
|
|
top: 10, |
|
|
@@ -130,9 +122,6 @@ function getExtraWidth(m) { |
|
|
|
const INIT_CHART_UPDATE_TIMEOUT = 700; |
|
|
|
const CHART_POST_ANIMATE_TIMEOUT = 400; |
|
|
|
|
|
|
|
const DEFAULT_AXIS_CHART_TYPE = 'line'; |
|
|
|
const AXIS_DATASET_CHART_TYPES = ['line', 'bar']; |
|
|
|
|
|
|
|
const AXIS_LEGEND_BAR_SIZE = 100; |
|
|
|
|
|
|
|
const BAR_CHART_SPACE_RATIO = 0.5; |
|
|
@@ -159,8 +148,6 @@ const DEFAULT_CHART_COLORS = ['light-blue', 'blue', 'violet', 'red', 'orange', |
|
|
|
'yellow', 'green', 'light-green', 'purple', 'magenta', 'light-grey', 'dark-grey']; |
|
|
|
const HEATMAP_COLORS_GREEN = ['#ebedf0', '#c6e48b', '#7bc96f', '#239a3b', '#196127']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const DEFAULT_COLORS = { |
|
|
|
bar: DEFAULT_CHART_COLORS, |
|
|
|
line: DEFAULT_CHART_COLORS, |
|
|
@@ -306,19 +293,6 @@ function floatTwo(d) { |
|
|
|
return parseFloat(d.toFixed(2)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns whether or not two given arrays are equal. |
|
|
|
* @param {Array} arr1 First array |
|
|
|
* @param {Array} arr2 Second array |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Shuffles array in place. ES6 version |
|
|
|
* @param {Array} array An array containing the items. |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Fill an array with extra points |
|
|
|
* @param {Array} array Array |
|
|
@@ -344,11 +318,6 @@ function getStringWidth(string, charWidth) { |
|
|
|
return (string+"").length * charWidth; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// https://stackoverflow.com/a/29325222 |
|
|
|
|
|
|
|
|
|
|
|
function getPositionByAngle(angle, radius) { |
|
|
|
return { |
|
|
|
x: Math.sin(angle * ANGLE_RATIO) * radius, |
|
|
@@ -514,8 +483,6 @@ function makeSVGGroup(className, transform='', parent=undefined) { |
|
|
|
return createSVG('g', args); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function makePath(pathStr, className='', stroke='none', fill='none') { |
|
|
|
return createSVG('path', { |
|
|
|
className: className, |
|
|
@@ -1737,17 +1704,14 @@ class AggregationChart extends BaseChart { |
|
|
|
|
|
|
|
const NO_OF_YEAR_MONTHS = 12; |
|
|
|
const NO_OF_DAYS_IN_WEEK = 7; |
|
|
|
|
|
|
|
const NO_OF_MILLIS = 1000; |
|
|
|
const SEC_IN_DAY = 86400; |
|
|
|
|
|
|
|
const MONTH_NAMES = ["January", "February", "March", "April", "May", |
|
|
|
"June", "July", "August", "September", "October", "November", "December"]; |
|
|
|
|
|
|
|
|
|
|
|
const DAY_NAMES_SHORT = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; |
|
|
|
|
|
|
|
|
|
|
|
// https://stackoverflow.com/a/11252167/6495043 |
|
|
|
function treatAsUtc(date) { |
|
|
|
let result = new Date(date); |
|
|
@@ -1769,10 +1733,6 @@ function clone(date) { |
|
|
|
return new Date(date.getTime()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// export function getMonthsBetween(startDate, endDate) {} |
|
|
|
|
|
|
|
function getWeeksBetween(startDate, endDate) { |
|
|
@@ -2647,8 +2607,6 @@ function getZeroIndex(yPts) { |
|
|
|
return zeroIndex; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getIntervalSize(orderedArray) { |
|
|
|
return orderedArray[1] - orderedArray[0]; |
|
|
|
} |
|
|
@@ -2661,10 +2619,6 @@ function scale(val, yAxis) { |
|
|
|
return floatTwo(yAxis.zeroLine - val * yAxis.scaleMultiplier); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getClosestInArray(goal, arr, index = false) { |
|
|
|
let closest = arr.reduce(function(prev, curr) { |
|
|
|
return (Math.abs(curr - goal) < Math.abs(prev - goal) ? curr : prev); |
|
|
@@ -3017,7 +2971,6 @@ function dataPrep(data, type) { |
|
|
|
|
|
|
|
// Set type |
|
|
|
if(!d.chartType ) { |
|
|
|
if(!AXIS_DATASET_CHART_TYPES.includes(type)) type === DEFAULT_AXIS_CHART_TYPE; |
|
|
|
d.chartType = type; |
|
|
|
} |
|
|
|
|
|
|
@@ -3677,7 +3630,6 @@ class AxisChart extends BaseChart { |
|
|
|
// removeDataPoint(index = 0) {} |
|
|
|
} |
|
|
|
|
|
|
|
// import MultiAxisChart from './charts/MultiAxisChart'; |
|
|
|
const chartTypes = { |
|
|
|
bar: AxisChart, |
|
|
|
line: AxisChart, |
|
|
|