Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private restoreSelections() {
if (!this.trackedSelections) {
return;
}
const value = hash.getProp(AppConstants.HASH_PROPS.SELECTION, '');
if (value === '') {
return;
}
const ranges = value.split(';').map((s) => parse(s));
this.trackedSelections.select(ranges);
}
export function selectTimePointFromHash(timepoints: ITacoTimePoint[]) {
if (hash.has(AppConstants.HASH_PROPS.TIME_POINTS) === false) {
return;
}
const selectedTPKeys: string[] = hash.getProp(AppConstants.HASH_PROPS.TIME_POINTS).split(',');
const selectedTimePoints = timepoints.filter((d) => selectedTPKeys.indexOf(d.key) > -1);
const showDetailView = hash.getInt(AppConstants.HASH_PROPS.DETAIL_VIEW);
selectTimePoint(...selectedTimePoints);
if (selectedTimePoints.length === 2 && showDetailView === 1) {
hash.setInt(AppConstants.HASH_PROPS.DETAIL_VIEW, showDetailView);
events.fire(AppConstants.EVENT_OPEN_DETAIL_VIEW, selectedTimePoints);
} else {
hash.removeProp(AppConstants.HASH_PROPS.DETAIL_VIEW);
}
}
const selectedData = data.filter((d, i) => d.key === hash.getProp(AppConstants.HASH_PROPS.DATASET));
export const COLOR_NO_CHANGE = '#fff';
export const COLOR_CONTENT_NEGATIVE = '#8da0cb';
export const COLOR_CONTENT_POSITIVE = '#d8b365';
export interface IChangeType {
type: string;
ratioName: string;
countName: string;
label: string;
isActive: boolean;
abbr: string;
}
const defaultFilter = hash.getProp(AppConstants.HASH_PROPS.FILTER, 'NCAR');
export class ChangeTypes {
static NO_CHANGE: IChangeType = {
type: 'nochange',
ratioName: 'no_ratio',
countName: 'no_counts',
label: 'No changes',
abbr: 'N',
isActive: defaultFilter.includes('N')
};
static CONTENT: IChangeType = {
type: 'content',
ratioName: 'c_ratio',
countName: 'c_counts',