feat: updated build

This commit is contained in:
Shivam Mishra 2020-04-30 14:01:59 +05:30
parent 53d14004bb
commit d7b6f4e9fc
11 changed files with 39 additions and 58 deletions

View File

@ -493,8 +493,10 @@ function lightenDarkenColor(color, amt) {
} }
function isValidColor(string) { function isValidColor(string) {
// https://stackoverflow.com/a/8027444/6495043 // https://stackoverflow.com/a/32685393
return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(string); let HEX_RE = /(^\s*)(#)((?:[A-Fa-f0-9]{3}){1,2})$/i;
let RGB_RE = /(^\s*)(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/i;
return HEX_RE.test(string) || RGB_RE.test(string);
} }
const getColor = (color) => { const getColor = (color) => {
@ -3637,17 +3639,19 @@ class AxisChart extends BaseChart {
if(!s.yExtremes) return; if(!s.yExtremes) return;
let index = getClosestInArray(relX, s.xAxis.positions, true); let index = getClosestInArray(relX, s.xAxis.positions, true);
let dbi = this.dataByIndex[index]; if (index >= 0) {
let dbi = this.dataByIndex[index];
this.tip.setValues( this.tip.setValues(
dbi.xPos + this.tip.offset.x, dbi.xPos + this.tip.offset.x,
dbi.yExtreme + this.tip.offset.y, dbi.yExtreme + this.tip.offset.y,
{name: dbi.formattedLabel, value: ''}, {name: dbi.formattedLabel, value: ''},
dbi.values, dbi.values,
index index
); );
this.tip.showTip(); this.tip.showTip();
}
} }
renderLegend() { renderLegend() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -143,12 +143,12 @@ var lineCompositeData = {
yMarkers: [{ yMarkers: [{
label: "Average 100 reports/month", label: "Average 100 reports/month",
value: 1200, value: 1200,
options: { labelPos: 'left' } options: { labelPos: "left" }
}], }],
datasets: [{ datasets: [{
"name": "Events", name: "Events",
"values": reportCountList values: reportCountList
}] }]
}; };
@ -180,31 +180,31 @@ var typeData = {
yMarkers: [{ yMarkers: [{
label: "Marker", label: "Marker",
value: 43, value: 43,
options: { labelPos: 'left' options: { labelPos: "left" }
// type: 'dashed' // type: 'dashed'
} }], }],
yRegions: [{ yRegions: [{
label: "Region", label: "Region",
start: -10, start: -10,
end: 50, end: 50,
options: { labelPos: 'right' } options: { labelPos: "right" }
}], }],
datasets: [{ datasets: [{
name: "Some Data", name: "Some Data",
values: [18, 40, 30, 35, 8, 52, 17, -4], values: [18, 40, 30, 35, 8, 52, 17, -4],
axisPosition: 'right', axisPosition: "right",
chartType: 'bar' chartType: "bar"
}, { }, {
name: "Another Set", name: "Another Set",
values: [30, 50, -10, 15, 18, 32, 27, 14], values: [30, 50, -10, 15, 18, 32, 27, 14],
axisPosition: 'right', axisPosition: "right",
chartType: 'bar' chartType: "bar"
}, { }, {
name: "Yet Another", name: "Yet Another",
values: [15, 20, -3, -15, 58, 12, -17, 37], values: [15, 20, -3, -15, 58, 12, -17, 37],
chartType: 'line' chartType: "line"
}] }]
}; };
@ -218,35 +218,10 @@ var trendsData = {
var moonData = { var moonData = {
names: ["Ganymede", "Callisto", "Io", "Europa"], names: ["Ganymede", "Callisto", "Io", "Europa"],
masses: [14819000, 10759000, 8931900, 4800000], masses: [14819000, 10759000, 8931900, 4800000],
distances: [1070.412, 1882.709, 421.700, 671.034], distances: [1070.412, 1882.709, 421.7, 671.034],
diameters: [5262.4, 4820.6, 3637.4, 3121.6] diameters: [5262.4, 4820.6, 3637.4, 3121.6]
}; };
// const jupiterMoons = {
// 'Ganymede': {
// mass: '14819000 x 10^16 kg',
// 'semi-major-axis': '1070412 km',
// 'diameter': '5262.4 km'
// },
// 'Callisto': {
// mass: '10759000 x 10^16 kg',
// 'semi-major-axis': '1882709 km',
// 'diameter': '4820.6 km'
// },
// 'Io': {
// mass: '8931900 x 10^16 kg',
// 'semi-major-axis': '421700 km',
// 'diameter': '3637.4 km'
// },
// 'Europa': {
// mass: '4800000 x 10^16 kg',
// 'semi-major-axis': '671034 km',
// 'diameter': '3121.6 km'
// },
// };
// ================================================================================
var demoConfig = { var demoConfig = {
lineComposite: { lineComposite: {
elementID: "#chart-composite-1", elementID: "#chart-composite-1",
@ -305,6 +280,8 @@ var demoConfig = {
} }
}; };
/* eslint-disable no-unused-vars */
/* eslint-enable no-unused-vars */
// import { lineComposite, barComposite } from './demoConfig'; // import { lineComposite, barComposite } from './demoConfig';
// ================================================================================ // ================================================================================

File diff suppressed because one or more lines are too long