Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some MS-Edge issues #90

Merged
merged 1 commit into from
Mar 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion packages/perspective-viewer-d3fc/src/js/axis/crossAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,22 @@ export const scale = (settings, settingName = "crossValues") => {

const defaultScaleBand = () => minBandwidth(d3.scaleBand());

const flattenArray = array => {
matt-hooper marked this conversation as resolved.
Show resolved Hide resolved
if (Array.isArray(array)) {
return [].concat(...array.map(flattenArray));
} else {
return [array];
}
};

export const domain = settings => {
let valueName = "crossValue";
let settingName = "crossValues";

const extentTime = fc.extentTime().accessors([d => new Date(d[valueName])]);

const _domain = function(data) {
const flattenedData = data.flat(2);
const flattenedData = flattenArray(data);
switch (axisType(settings, settingName)) {
case AXIS_TYPES.time:
return extentTime(flattenedData);
Expand Down
6 changes: 6 additions & 0 deletions packages/perspective-viewer-d3fc/src/js/plugin/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class D3FCChartElement extends HTMLElement {
this._chart = chart;
this._settings = this._configureSettings(this._settings, settings);
this.draw();

if (window.navigator.userAgent.indexOf("Edge") > -1) {
// Workaround for MS Edge issue that doesn't draw content in the
// plot-area until the chart D3 object is redrawn
setTimeout(() => this.draw());
}
}

draw() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ function fromDomain(domain) {

export function withoutOpacity(colour) {
const lastComma = colour.lastIndexOf(",");
return lastComma !== -1 ? `${colour.substring(0, lastComma)})` : colour;
const valueIndex = colour.indexOf("(");
return valueIndex !== -1 && lastComma !== -1 ? `rgb(${colour.substring(valueIndex + 1, lastComma)})` : colour;
}

export function withOpacity(colour) {
if (colour.includes("rgba")) return colour;
if (colour.includes("rgb")) return colour;

const toInt = offset => parseInt(colour.substring(offset, offset + 2), 16);
return `rgba(${toInt(1)},${toInt(3)},${toInt(5)},0.5)`;
Expand Down