Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Fix error and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sycombs committed May 6, 2024
1 parent ce742d1 commit 644b106
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,15 @@ const getValueRegionSubset = (dataTarget, getXDataValues) => {
};
let continuousRegions = [];

const isValidValueRegion = (region) => (!utils.isEmpty(region) && !utils.isEmpty(region.start) && !utils.isEmpty(region.end));

dataTarget.values.forEach((value, index) => {
if (!utils.isEmpty(value.regions)) {
const previousValueRegions = index > 0 ? dataTarget.values[index - 1].regions : null;
const previousColors = previousValueRegions ? previousValueRegions.map(r => r.color) : [];
const previousColors = previousValueRegions ? previousValueRegions.map(r => isValidValueRegion(r) && r.color) : [];

value.regions.forEach((region) => {
if (!utils.isEmpty(region)
&& !utils.isEmpty(region.start)
&& !utils.isEmpty(region.end)
) {
if (isValidValueRegion(region)) {
// If the color is not present in the previous value regions, then move it to new region set
if (!previousColors.includes(region.color)) {
if (valueRegion.values.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Terra.describeViewports('LineGraph ', ['tiny', 'medium', 'large'], () => {
it('validates multiple value regions graph container', () => {
browser.url('/raw/tests/cerner-terra-graphs-docs/graphs/line-graph/regions/multi-line/multiple-value-regions');

let element = $('.carbon-legend').$$('li');
const element = $('.carbon-legend').$$('li');
element[3].moveTo();
Terra.validates.screenshot('multiline_multiple_value_regions', { selector: '.carbon-graph-container' });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,85 +20,85 @@ const data = {
regions: [{
start: -10,
end: 0,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 0,
end: 10,
color: Carbon.helpers.COLORS.GREY
}]
},{
color: Carbon.helpers.COLORS.GREY,
}],
}, {
x: 115,
y: -10,
regions: [{
start: -15,
end: -5,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 5,
end: 15,
color: Carbon.helpers.COLORS.GREY
}]
},{
color: Carbon.helpers.COLORS.GREY,
}],
}, {
x: 155,
y: -15,
regions: [{
start: -20,
end: -10,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 10,
end: 20,
color: Carbon.helpers.COLORS.GREY
}]
},{
color: Carbon.helpers.COLORS.GREY,
}],
}, {
x: 175,
y: -20,
regions: [{
start: -25,
end: -15,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 15,
end: 25,
color: Carbon.helpers.COLORS.GREY
}]
},{
color: Carbon.helpers.COLORS.GREY,
}],
}, {
x: 225,
y: -15,
regions: [{
start: -20,
end: -10,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 10,
end: 20,
color: Carbon.helpers.COLORS.GREY
}]
},{
color: Carbon.helpers.COLORS.GREY,
}],
}, {
x: 255,
y: -10,
regions: [{
start: -15,
end: -5,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 5,
end: 15,
color: Carbon.helpers.COLORS.GREY
}]
},{
color: Carbon.helpers.COLORS.GREY,
}],
}, {
x: 275,
y: -5,
regions: [{
start: -10,
end: -0,
color: Carbon.helpers.COLORS.LAVENDER
},{
color: Carbon.helpers.COLORS.LAVENDER,
}, {
start: 0,
end: 10,
color: Carbon.helpers.COLORS.GREY
}]
}]
color: Carbon.helpers.COLORS.GREY,
}],
}],
};

export default data;
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ const exampleData = {
start: 10,
end: 20,
color: Carbon.helpers.COLORS.GREY,
},{
}, {
start: 21,
end: 36,
color: Carbon.helpers.COLORS.LIGHT_GREEN,
},],
}],
},
{
x: new Date(2016, 0, 1, 5, 15).toISOString(),
Expand All @@ -84,11 +84,11 @@ const exampleData = {
start: 10,
end: 20,
color: Carbon.helpers.COLORS.GREY,
},{
}, {
start: 21,
end: 36,
color: Carbon.helpers.COLORS.LIGHT_GREEN,
},],
}],
},
{
x: new Date(2016, 0, 1, 6, 15).toISOString(),
Expand Down

0 comments on commit 644b106

Please sign in to comment.