From 3d1e822cdcf1bcaaeeb44d170a7097b3d5e7431b Mon Sep 17 00:00:00 2001 From: lana-k Date: Sat, 1 Nov 2025 15:49:34 +0100 Subject: [PATCH] link to docs, disable some settings, check result set --- src/assets/styles/messages.css | 7 ++ src/assets/styles/typography.css | 45 ++++++++++++ .../AdvancedForceAtlasLayoutSettings.vue | 16 ++--- src/components/Graph/EdgeColorSettings.vue | 10 ++- .../Graph/ForceAtlasLayoutSettings.vue | 6 +- src/components/Graph/NodeColorSettings.vue | 12 +++- src/lib/graphHelper.js | 69 ++++++++++++++----- src/main.js | 1 + .../Tabs/Tab/DataView/Chart/index.vue | 9 +-- .../Tabs/Tab/DataView/Graph/GraphEditor.vue | 6 +- .../Tabs/Tab/DataView/Graph/index.vue | 25 ++++--- .../Tabs/Tab/DataView/Pivot/index.vue | 4 ++ src/views/MainView/Workspace/index.vue | 19 ++++- 13 files changed, 173 insertions(+), 56 deletions(-) create mode 100644 src/assets/styles/typography.css diff --git a/src/assets/styles/messages.css b/src/assets/styles/messages.css index 39b4f48..f401261 100644 --- a/src/assets/styles/messages.css +++ b/src/assets/styles/messages.css @@ -4,3 +4,10 @@ font-size: 13px; padding: 0 24px; } + +.data-view-warning { + height: 40px; + line-height: 40px; + border-bottom: 1px solid var(--color-border); + box-sizing: border-box; +} diff --git a/src/assets/styles/typography.css b/src/assets/styles/typography.css new file mode 100644 index 0000000..a5d334b --- /dev/null +++ b/src/assets/styles/typography.css @@ -0,0 +1,45 @@ +@font-face { + font-family: 'Open Sans'; + src: url('@/assets/fonts/OpenSans-Regular.woff2'); + font-weight: 400; + font-style: normal; +} + +@font-face { + font-family: 'Open Sans'; + src: url('@/assets/fonts/OpenSans-SemiBold.woff2'); + font-weight: 600; + font-style: normal; +} + +@font-face { + font-family: 'Open Sans'; + src: url('@/assets/fonts/OpenSans-Bold.woff2'); + font-weight: 700; + font-style: normal; +} + +@font-face { + font-family: 'Open Sans'; + src: url('@/assets/fonts/OpenSans-Italic.woff2'); + font-weight: 400; + font-style: italic; +} + +@font-face { + font-family: 'Open Sans'; + src: url('@/assets/fonts/OpenSans-SemiBoldItalic.woff2'); + font-weight: 600; + font-style: italic; +} + +@font-face { + font-family: 'Open Sans'; + src: url('@/assets/fonts/OpenSans-BoldItalic.woff2'); + font-weight: 700; + font-style: italic; +} + +a { + color: var(--color-accent-shade); +} diff --git a/src/components/Graph/AdvancedForceAtlasLayoutSettings.vue b/src/components/Graph/AdvancedForceAtlasLayoutSettings.vue index 0f2902f..2adc679 100644 --- a/src/components/Graph/AdvancedForceAtlasLayoutSettings.vue +++ b/src/components/Graph/AdvancedForceAtlasLayoutSettings.vue @@ -1,5 +1,12 @@ diff --git a/src/components/Graph/NodeColorSettings.vue b/src/components/Graph/NodeColorSettings.vue index e28eb0f..7517532 100644 --- a/src/components/Graph/NodeColorSettings.vue +++ b/src/components/Graph/NodeColorSettings.vue @@ -27,7 +27,7 @@ /> - + - + - + { + const parsedRec = JSON.parse(record) + if (Object.keys(parsedRec).length < 2) { + throw new Error('The records must have at least 2 keys') + } + }) + const firstRecord = JSON.parse(records[0]) + if ( + !Object.keys(firstRecord).some(key => { + return records + .map(record => JSON.parse(record)[key]) + .every(value => value === 0 || value === 1) + }) + ) { + throw new Error( + 'There must be a common key used as object type: 0 - node, 1 - edge' + ) + } + return true + } catch (err) { + return false + } +} + export function buildNodes(graph, dataSources, options) { - const docColumn = Object.keys(dataSources)[0] || 'doc' + const docColumn = Object.keys(dataSources)[0] const { objectType, nodeId } = options.structure if (objectType && nodeId) { @@ -110,10 +141,23 @@ function getUpdateSizeMethod(graph, sizeSettings) { if (type === 'constant') { return attributes => (attributes.size = value) } else if (type === 'variable') { - return getVariabledSizeMethod(mode, source, scale, min) + return attributes => { + attributes.size = getVariabledSize( + mode, + attributes.data[source], + scale, + min + ) + } } else { - return (attributes, nodeId) => - (attributes.size = Math.max(graph[method](nodeId) * scale, min)) + return (attributes, nodeId) => { + attributes.size = getVariabledSize( + mode, + graph[method](nodeId), + scale, + min + ) + } } } @@ -184,22 +228,13 @@ function getUpdateEdgeColorMethod(graph, colorSettings) { } } -function getVariabledSizeMethod(mode, source, scale, min) { +function getVariabledSize(mode, value, scale, min) { if (mode === 'diameter') { - return attributes => - (attributes.size = Math.max( - (attributes.data[source] / 2) * scale, - min / 2 - )) + return Math.max((value / 2) * scale, min / 2) } else if (mode === 'area') { - return attributes => - (attributes.size = Math.max( - Math.sqrt((attributes.data[source] / 2) * scale), - min / 2 - )) + return Math.max(Math.sqrt((value / 2) * scale), min / 2) } else { - return attributes => - (attributes.size = Math.max(attributes.data[source] * scale, min)) + return Math.max(value * scale, min) } } diff --git a/src/main.js b/src/main.js index 2490c54..0aedff8 100644 --- a/src/main.js +++ b/src/main.js @@ -5,6 +5,7 @@ import store from '@/store' import { createVfm, VueFinalModal, useVfm } from 'vue-final-modal' import '@/assets/styles/variables.css' +import '@/assets/styles/typography.css' import '@/assets/styles/buttons.css' import '@/assets/styles/tables.css' import '@/assets/styles/dialogs.css' diff --git a/src/views/MainView/Workspace/Tabs/Tab/DataView/Chart/index.vue b/src/views/MainView/Workspace/Tabs/Tab/DataView/Chart/index.vue index 8b5ab87..4d038e4 100644 --- a/src/views/MainView/Workspace/Tabs/Tab/DataView/Chart/index.vue +++ b/src/views/MainView/Workspace/Tabs/Tab/DataView/Chart/index.vue @@ -1,6 +1,6 @@