1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2026-03-24 23:16:18 +08:00
This commit is contained in:
lana-k
2025-11-08 22:23:38 +01:00
parent d7db6a0f5d
commit 65c1c18fcb
6 changed files with 1305 additions and 31 deletions

View File

@@ -35,7 +35,12 @@
/>
</Field>
<Field v-if="modelValue.sourceUsage === 'map_to'">
<Field
v-if="
modelValue.sourceUsage === 'map_to' ||
modelValue.type === 'calculated'
"
>
<ColorscalePicker
:selected="modelValue.colorscale"
className="colorscale-picker"
@@ -46,7 +51,9 @@
</Field>
<Field
v-if="modelValue.type !== 'constant' && modelValue.sourceUsage === 'map_to'"
v-if="
modelValue.sourceUsage === 'map_to' || modelValue.type === 'calculated'
"
label="Color as"
>
<RadioBlocks
@@ -57,7 +64,9 @@
</Field>
<Field
v-if="modelValue.type !== 'constant' && modelValue.sourceUsage === 'map_to'"
v-if="
modelValue.sourceUsage === 'map_to' || modelValue.type === 'calculated'
"
label="Colorscale direction"
>
<RadioBlocks
@@ -126,7 +135,6 @@ export default {
},
calculated: {
method: 'degree',
sourceUsage: 'map_to',
colorscale: null,
mode: 'continious',
colorscaleDirection: 'normal'

View File

@@ -47,8 +47,7 @@ export function buildNodes(graph, dataSources, options) {
nodes.forEach(node => {
if (node[nodeId]) {
graph.addNode(node[nodeId], {
data: node,
labelColor: options.style.nodes.label.color
data: node
})
}
})
@@ -56,7 +55,7 @@ export function buildNodes(graph, dataSources, options) {
}
export function buildEdges(graph, dataSources, options) {
const docColumn = Object.keys(dataSources)[0] || 'doc'
const docColumn = Object.keys(dataSources)[0]
const { objectType, edgeSource, edgeTarget } = options.structure
if (objectType && edgeSource && edgeTarget) {
@@ -69,8 +68,7 @@ export function buildEdges(graph, dataSources, options) {
const target = edge[edgeTarget]
if (graph.hasNode(source) && graph.hasNode(target)) {
graph.addEdge(source, target, {
data: edge,
labelColor: options.style.edges.label.color
data: edge
})
}
})
@@ -261,7 +259,6 @@ function getColorMethod(
colorscale[index % colorscale.length]
])
)
return (attributes, nodeId) => {
const category = sourceGetter(nodeId, attributes)
attributes.color = colorMap[category]
@@ -277,6 +274,7 @@ function getColorMethod(
const value = sourceGetter(nodeId, attributes)
const normalizedValue = (value - min) / (max - min)
if (isNaN(normalizedValue)) {
attributes.color = '#000000'
return
}
const exactMatch = normalizedColorscale.find(
@@ -288,9 +286,9 @@ function getColorMethod(
}
const rightColorIndex = normalizedColorscale.findIndex(
([value]) => value >= normalizedValue
([value]) => value > normalizedValue
)
const leftColorIndex = (rightColorIndex || 1) - 1
const leftColorIndex = rightColorIndex - 1
const right = normalizedColorscale[rightColorIndex]
const left = normalizedColorscale[leftColorIndex]
const interpolationFactor =
@@ -327,18 +325,3 @@ function getEdgeValueScale(graph, sourceGetter) {
}, new Set())
return Array.from(scaleSet).sort((a, b) => a - b)
}
export function getOptionsFromDataSources(dataSources) {
if (!dataSources) {
return []
}
return Object.keys(dataSources).map(name => ({
value: name,
label: name
}))
}
export default {
getOptionsFromDataSources
}

View File

@@ -31,7 +31,7 @@ import fIo from '@/lib/utils/fileIo'
import $ from 'jquery'
import 'pivottable'
import 'pivottable/dist/pivot.css'
import PivotUi from './PivotUi'
import PivotUi from './PivotUi/index.vue'
import pivotHelper from './pivotHelper'
import Chart from '@/views/MainView/Workspace/Tabs/Tab/DataView/Chart'
import chartHelper from '@/lib/chartHelper'