Skip to content
Snippets Groups Projects
Commit a918543f authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

add custom scale

parent 3023c454
No related branches found
No related tags found
1 merge request!500RTGM Updates
......@@ -300,8 +300,23 @@ export class AppService
}
}
private colorScale(): readonly string[] {
return d3Color.schemeGnBu[9].slice(3, 8);
private colorScale(iterations: RtgmIteration[]): readonly string[] {
const ncolor = iterations.length % 9;
const colors: (readonly string[])[] = [
[],
['#084081'],
['#2b8cbe', '#084081'],
['#7bccc4', '#2b8cbe', '#084081'],
['#ccebc5', '#7bccc4', '#2b8cbe', '#084081'],
['#f7fcf0', '#ccebc5', '#7bccc4', '#2b8cbe', '#084081'],
d3Color.schemeGnBu[6],
d3Color.schemeGnBu[7],
d3Color.schemeGnBu[8],
d3Color.schemeGnBu[9],
];
return colors[ncolor];
}
private createDerivativeFragilityPlot(
......@@ -354,7 +369,7 @@ export class AppService
yRange: number[]
): Partial<PlotData>[] {
const fragilitySlices: Partial<PlotData>[] = [];
const colors = this.colorScale();
const colors = this.colorScale(iterations);
iterations.forEach((iteration, index) => {
const color = colors[index % iterations.length];
......@@ -466,7 +481,7 @@ export class AppService
const hazardFragilityPlotData: Partial<PlotData>[] = [];
const integralHazardFragilityPlotData: Partial<PlotData>[] = [];
const colors = this.colorScale();
const colors = this.colorScale(iterations);
iterations.forEach((iteration, index) => {
const color = colors[index % iterations.length];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment