From 85feb5caccfa037353047c39ca508f5c79fe6fb8 Mon Sep 17 00:00:00 2001 From: Sagar Date: Fri, 13 Dec 2024 13:41:44 +0100 Subject: [PATCH 1/2] fix: corrected the name and alignment --- app/Livewire/BubbleFrequencyPlot.php | 6 ++---- resources/views/livewire/bubble-frequency-plot.blade.php | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/Livewire/BubbleFrequencyPlot.php b/app/Livewire/BubbleFrequencyPlot.php index c0483b34..19c52a57 100644 --- a/app/Livewire/BubbleFrequencyPlot.php +++ b/app/Livewire/BubbleFrequencyPlot.php @@ -8,9 +8,7 @@ class BubbleFrequencyPlot extends Component { public $chartData; - public $firstColumnName; - - public $secondColumnName; + public $columnName; public $chartId; @@ -21,7 +19,7 @@ class BubbleFrequencyPlot extends Component public function mount($chartName, $chartData) { // Extract column names - [$this->firstColumnName, $this->secondColumnName] = explode('|', $chartName); + [$this->columnName] = explode('|', $chartName); // Ensure data is properly formatted $this->chartData = array_map(function ($item) { diff --git a/resources/views/livewire/bubble-frequency-plot.blade.php b/resources/views/livewire/bubble-frequency-plot.blade.php index 2fe2947f..db7c96b1 100644 --- a/resources/views/livewire/bubble-frequency-plot.blade.php +++ b/resources/views/livewire/bubble-frequency-plot.blade.php @@ -1,9 +1,9 @@ {{-- resources/views/livewire/word-bubble-chart.blade.php --}} -
+

- {!! $name_corrections[$firstColumnName] ?? ucfirst(str_replace('_', ' ', $firstColumnName)) !!} vs {!! $name_corrections[$secondColumnName] ?? ucfirst(str_replace('_', ' ', $secondColumnName)) !!} + {!! $name_corrections[$columnName] ?? ucfirst(str_replace('_', ' ', $columnName)) !!}

-
+
From 8e84a7050010726cfc4052bb8729d08e9efdd345 Mon Sep 17 00:00:00 2001 From: Sagar Date: Fri, 13 Dec 2024 14:47:42 +0100 Subject: [PATCH 2/2] fix: names in titles, axes and legends are corrected --- app/Livewire/BubbleFrequencyPlot.php | 3 +- app/Livewire/PropertiesPlot.php | 1 + .../livewire/annotation-score-plot.blade.php | 9 ++- .../livewire/bubble-frequency-plot.blade.php | 4 +- .../views/livewire/density-plot.blade.php | 8 +- .../views/livewire/properties-plot.blade.php | 79 +------------------ 6 files changed, 17 insertions(+), 87 deletions(-) diff --git a/app/Livewire/BubbleFrequencyPlot.php b/app/Livewire/BubbleFrequencyPlot.php index 19c52a57..3cef5d45 100644 --- a/app/Livewire/BubbleFrequencyPlot.php +++ b/app/Livewire/BubbleFrequencyPlot.php @@ -13,7 +13,8 @@ class BubbleFrequencyPlot extends Component public $chartId; public $name_corrections = [ - + 'np_classifier_class' => 'NPClassifier\'s Chemical Classes ', + 'chemical_class' => 'ClassyFire\'s Chemical Classes ', ]; public function mount($chartName, $chartData) diff --git a/app/Livewire/PropertiesPlot.php b/app/Livewire/PropertiesPlot.php index 644e71e0..b748578c 100644 --- a/app/Livewire/PropertiesPlot.php +++ b/app/Livewire/PropertiesPlot.php @@ -19,6 +19,7 @@ class PropertiesPlot extends Component 'qed_drug_likeliness' => 'QED drug likeness', 'hydrogen_bond_acceptors_lipinski' => 'Hydrogen bond acceptors Lipinski', 'hydrogen_bond_donors_lipinski' => 'Hydrogen bond donors Lipinski', + 'lipinski_rule_of_five_violations' => 'Lipinski\'s rule of 5 violations', ]; public function mount($property, $name) diff --git a/resources/views/livewire/annotation-score-plot.blade.php b/resources/views/livewire/annotation-score-plot.blade.php index 047a65f9..b49565c4 100644 --- a/resources/views/livewire/annotation-score-plot.blade.php +++ b/resources/views/livewire/annotation-score-plot.blade.php @@ -1,7 +1,10 @@

- Annotations Score + COCONUT Annotation Score + + +

@@ -21,7 +24,7 @@ const data_annotation = @js($data['molecules']['annotation_level']); const datasets_annotation = [{ - label: 'COCONUT', + label: 'COCONUT Data', data: data_annotation.overall.density_data.map(point => ({ x: point.x, y: point.y @@ -62,7 +65,7 @@ type: 'linear', title: { display: true, - text: 'Annotations Score' + text: 'COCONUT Annotation Score' }, ticks: { stepSize: 1 diff --git a/resources/views/livewire/bubble-frequency-plot.blade.php b/resources/views/livewire/bubble-frequency-plot.blade.php index db7c96b1..0e14a720 100644 --- a/resources/views/livewire/bubble-frequency-plot.blade.php +++ b/resources/views/livewire/bubble-frequency-plot.blade.php @@ -1,9 +1,9 @@ {{-- resources/views/livewire/word-bubble-chart.blade.php --}}
-

+

{!! $name_corrections[$columnName] ?? ucfirst(str_replace('_', ' ', $columnName)) !!}

-
+
diff --git a/resources/views/livewire/density-plot.blade.php b/resources/views/livewire/density-plot.blade.php index a6cb3d2e..c62e9088 100644 --- a/resources/views/livewire/density-plot.blade.php +++ b/resources/views/livewire/density-plot.blade.php @@ -1,9 +1,9 @@

- NP-Likeness + NP-Likeness Score - (DOI) +

@@ -25,7 +25,7 @@ const data = @js($data['properties']['np_likeness']); const datasets = [{ - label: 'COCONUT', + label: 'COCONUT Data', data: data.overall.density_data.map(point => ({ x: point.x, y: point.y @@ -66,7 +66,7 @@ type: 'linear', title: { display: true, - text: 'NP-likeness' + text: 'NP-Likeness Score' } }, y: { diff --git a/resources/views/livewire/properties-plot.blade.php b/resources/views/livewire/properties-plot.blade.php index 44d9b655..6f27566c 100644 --- a/resources/views/livewire/properties-plot.blade.php +++ b/resources/views/livewire/properties-plot.blade.php @@ -20,7 +20,7 @@ const plotData = @js($property); const datasets = [{ - label: 'COCONUT', + label: 'COCONUT Data', data: plotData.overall.density_data.map(point => ({ x: point.x, y: point.y @@ -32,22 +32,6 @@ fill: false }]; - Object.entries(plotData.collections).forEach(([name, collection], index) => { - datasets.push({ - label: name, - data: collection.density_data.map(point => ({ - x: point.x, - y: point.y - })), - borderColor: `hsl(${index * 30}, 70%, 50%)`, - borderWidth: 2, - pointRadius: 0, - tension: 0.4, - fill: false, - hidden: true - }); - }); - const chart = new Chart(plotCanvas, { type: 'line', data: { @@ -61,7 +45,7 @@ type: 'linear', title: { display: true, - text: '{{ ucfirst(str_replace('_', ' ', $name)) }}' + text: "{{ $name == 'van_der_walls_volume' ? 'Van der Waals volume' : $name_corrections[$name] ?? ucfirst(str_replace('_', ' ', $name)) }}" }, ticks: { stepSize: 1 @@ -84,67 +68,8 @@ } } }, - // plugins: [{ - // id: 'htmlLegend', - // beforeInit(chart) { - // const container = document.getElementById('legend-{{ $name }}'); - // if (!container) return; - - // // Clear existing legend - // container.innerHTML = ''; - - // const ul = document.createElement('ul'); - // ul.style.listStyle = 'none'; - // ul.style.padding = 0; - // ul.style.display = 'flex'; - // ul.style.flexWrap = 'wrap'; - // ul.style.gap = '8px'; - - // chart.data.datasets.forEach((dataset, i) => { - // const li = document.createElement('li'); - // li.style.marginBottom = '4px'; - // li.style.opacity = dataset.hidden ? '0.3' : '1'; - // li.style.display = 'flex'; - // li.style.alignItems = 'center'; - // li.style.minWidth = '120px'; - - // const button = document.createElement('button'); - // button.style.border = 'none'; - // button.style.background = dataset.borderColor; - // button.style.width = '12px'; - // button.style.height = '12px'; - // button.style.marginRight = '6px'; - // button.style.cursor = 'pointer'; - - // const label = document.createTextNode(dataset.label); - - // li.onclick = () => { - // dataset.hidden = !dataset.hidden; - // chart.update(); - // li.style.opacity = dataset.hidden ? '0.3' : '1'; - // }; - // li.style.cursor = 'pointer'; - // li.appendChild(button); - // li.appendChild(label); - // ul.appendChild(li); - // }); - - // container.appendChild(ul); - // } - // }] }); }); -
\ No newline at end of file