Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
const data = {
labels,
datasets: [{
label: 'Default',
fillColor: this.barColor,
data: seriesData,
}],
};
if (this.chart) {
this.chart.destroy();
}
const box = domGeo.getMarginBox(this.domNode);
this.contentNode.width = box.w;
this.contentNode.height = box.h;
const ctx = this.contentNode.getContext('2d');
this.chart = new window.Chart(ctx).Bar(data, this.chartOptions); // eslint-disable-line
},
});
this.showSearchExpression();
const data = array.map(rawData, (item, idx) => {
return {
value: Math.round(item.value),
color: this._getItemColor(idx),
highlight: '',
label: item.name,
};
});
if (this.chart) {
this.chart.destroy();
}
const box = domGeo.getMarginBox(this.domNode);
this.contentNode.width = box.w;
this.contentNode.height = box.h;
const ctx = this.contentNode.getContext('2d');
const chart = new window.Chart(ctx);
// Ensure the chart has the ability to render this type
this.renderAs = window.Chart.types.hasOwnProperty(this.renderAs) ? this.renderAs : defaultRenderAs;
this.chart = chart[this.renderAs](data, this.chartOptions);
this.showLegend();
},
_getItemColor: function _getItemColor(index) {
"Horizontal LinearLayout 3 Equal Width": function () {
var children = node.getChildren();
assert.strictEqual(children.length, 3);
var box1 = domGeom.getMarginBox(children[0]);
var box2 = domGeom.getMarginBox(children[1]);
var box3 = domGeom.getMarginBox(children[2]);
assert.strictEqual(box1.w, 333, "box1.w");
assert.strictEqual(box2.w, 333, "box2.w");
assert.strictEqual(box3.w, 333, "box3.w");
},
"Vertical LinearLayout Children Equal Size": function () {
var children = node2.getChildren();
var box1 = domGeom.getMarginBox(children[0]);
var box2 = domGeom.getMarginBox(children[1]);
assert.strictEqual(box1.h, 250, "box1");
assert.strictEqual(box2.h, 250, "box2");
}
},
"Size Computation": function () {
var box = domGeom.getMarginBox(node);
assert.isTrue(box.w > 0);
assert.isTrue(box.h > 0);
},
"Horizontal LinearLayout 3 Equal Width": function () {
var children = node.getChildren();
assert.strictEqual(children.length, 3);
var box1 = domGeom.getMarginBox(children[0]);
var box2 = domGeom.getMarginBox(children[1]);
var box3 = domGeom.getMarginBox(children[2]);
assert.strictEqual(box1.w, 333, "box1.w");
assert.strictEqual(box2.w, 333, "box2.w");
assert.strictEqual(box3.w, 333, "box3.w");
},
"Horizontal LinearLayout Various Width": function () {
var children = node.getChildren();
assert.strictEqual(children.length, 3);
var box1 = domGeom.getMarginBox(children[0]);
var box2 = domGeom.getMarginBox(children[1]);
var box3 = domGeom.getMarginBox(children[2]);
assert.strictEqual(box1.w, 40, "box1.w");
assert.strictEqual(box2.w, 600, "box2.w");
assert.strictEqual(box3.w, 40, "box3.w");
}
},
"Horizontal LinearLayout Fill Width": function () {
var children = node.getChildren();
assert.strictEqual(children.length, 2);
var box1 = domGeom.getMarginBox(children[0]);
assert.strictEqual(box1.w, 470);
},
_setCanvasWidth: function _setCanvasWidth() {
const box = domGeo.getMarginBox(this.domNode);
if (this.contentNode) {
this.contentNode.width = box.w;
}
},
_drawLoading: function _drawLoading() {
renderPdfPage: function renderPdfPage(pageNumber) {
if (pageNumber < 1 || this.pdfDoc === null) {
return;
}
if (pageNumber > this.pdfDoc.numPages) {
return;
}
if (this.pdfIsLoading) {
return;
}
const box = domGeo.getMarginBox(this.domNode);
this.pdfDoc.getPage(pageNumber).then((page) => {
const scale = this.pdfScale;
let viewport = page.getViewport(scale);
const canvas = document.getElementById('pdfViewer');
const context = canvas.getContext('2d');
const desiredWidth = box.w;
viewport = page.getViewport(desiredWidth / viewport.width);
canvas.height = viewport.height < box.h ? box.h : viewport.height;
canvas.width = viewport.width;
const renderContext = {
canvasContext: context,
viewport,
};
this.pdfIsLoading = true;