-
+
+
- {{ workspace_store.name }}
+ {{ workspaceStore.name }}
diff --git a/src/components/WorkspaceLoader.vue b/src/components/WorkspaceLoader.vue
index f1c1b30..e58d87c 100644
--- a/src/components/WorkspaceLoader.vue
+++ b/src/components/WorkspaceLoader.vue
@@ -8,7 +8,7 @@ import type { IAnalysis, IAnalysisOption } from 'src/interfaces';
const storeid_store = useStoreIDStore();
const hepdata_id = ref('');
-const analyses = ref([] as IAnalysis[]);
+const analyses = ref([]);
let analyses_to_load = [] as IAnalysisOption[];
const files = ref();
const button_is_disabled = computed(() => {
diff --git a/src/components/charts/ModifierStructureChart.vue b/src/components/charts/ModifierStructureChart.vue
index 1dc89eb..b5df067 100644
--- a/src/components/charts/ModifierStructureChart.vue
+++ b/src/components/charts/ModifierStructureChart.vue
@@ -69,14 +69,11 @@ const legend_height = computed(() => {
});
// pre-compute positions of rects
-const x_pos = computed(() => {
- // return list of x-positions for the modifiers
- return workspace_store.modifier_names.map(
- (_, index) => index * size + ylabel_length.value + label_offset
- );
-});
+const x_pos: number[] = workspace_store.modifier_names.map(
+ (_, index) => index * size + ylabel_length.value + label_offset
+);
-const y_pos = computed(() => {
+const y_pos: number[][] = (() => {
const positions: number[][] = [];
let channel_offset = 0;
for (const channel of workspace_store.channels) {
@@ -87,7 +84,7 @@ const y_pos = computed(() => {
channel_offset += channel.samples.length * size + padding;
}
return positions;
-});
+})();
// make interactive
const state = reactive({
diff --git a/src/components/charts/NormalizedBarChart.vue b/src/components/charts/NormalizedBarChart.vue
index 34e89a3..1b7844d 100644
--- a/src/components/charts/NormalizedBarChart.vue
+++ b/src/components/charts/NormalizedBarChart.vue
@@ -29,18 +29,12 @@ const offset =
(bar_height + padding) * workspace_store.channels.length + padding;
// create strings for path of axes
-const y_ticks = [
- ...Array(workspace_store.channels.length)
- .fill(0)
- .map((_, i) => (i + 0.5) * bar_height + (i + 1) * padding),
-];
+const y_ticks = Array.from({ length: workspace_store.channels.length }, (_, i) =>
+ (i + 0.5) * bar_height + (i + 1) * padding
+);
const yaxis_path = axis_path(0, 0, offset, y_ticks, false, true);
-const x_ticks = [
- ...Array(number_of_ticks)
- .fill(0)
- .map((_, i) => i * (x_range / (number_of_ticks - 1))),
-];
+const x_ticks = Array.from({ length: number_of_ticks }, (_, i) => i * (x_range / (number_of_ticks - 1)));
const xaxis_path = axis_path(0, offset, x_range, x_ticks, true, true);
// the height of the plot should be at least the height of the bars corresponding to the different channels
diff --git a/src/components/charts/StackedChart.vue b/src/components/charts/StackedChart.vue
index ec1430a..1eb9f5d 100644
--- a/src/components/charts/StackedChart.vue
+++ b/src/components/charts/StackedChart.vue
@@ -21,27 +21,14 @@ const channel = workspace_store.channels[props.channel_index];
const number_of_bins = channel.samples[0].data.length;
-const bins = Array.from({ length: number_of_bins }, (e, i) => i);
+const bins = Array.from({ length: number_of_bins }, (_, i) => i);
const maximum = computed(() => {
let max = 0;
- for (
- let i_bin = 0;
- i_bin < channel.stacked_data_per_bin.content.length;
- i_bin++
- ) {
- const high_value =
- channel.stacked_data_per_bin.content[i_bin][
- workspace_store.process_names.length - 1
- ].high;
- if (max < high_value) {
- max = high_value;
- }
- const data_value = channel.stacked_data_per_bin.data[i_bin];
- if (max < data_value) {
- max = data_value;
- }
- }
+ channel.stacked_data_per_bin.content.forEach((binContent, i_bin) => {
+ const high = binContent[workspace_store.process_names.length - 1].high;
+ max = Math.max(max, high, channel.stacked_data_per_bin.data[i_bin]);
+ });
return max;
});
@@ -90,23 +77,16 @@ const y_ticks = computed(() => {
} else if (max >= 3) {
stepsize = 1;
}
- let i = 0;
const ticks = [];
- while (i <= max) {
+ for (let i = 0; i <= max; i+= stepsize) {
ticks.push(i);
- i += stepsize;
}
return ticks;
});
-const y_tick_positions = computed(() => {
- const max = maximum_normalised.value;
- let tick_positions = [];
- for (const tick of y_ticks.value) {
- tick_positions.push(-(300 / max) * tick);
- }
- return tick_positions;
-});
+const y_tick_positions = computed(() =>
+ y_ticks.value.map(tick => -(300 / maximum_normalised.value) * tick)
+);
const yaxis_path = axis_path(100, 350, 40, y_tick_positions.value, false, true);
@@ -226,14 +206,10 @@ const yaxis_path = axis_path(100, 350, 40, y_tick_positions.value, false, true);