Add conditional styling for vertex and edge types#1915
Open
jkemmererupgrade wants to merge 1 commit into
Open
Conversation
Adds an optional per-type condition that layers an alternate style on matching vertices and edges. The condition is type-aware (numeric/string/boolean comparisons) and evaluated in JS at render time. Conditional styles are included in styling import, export, and reset. Updates docs/features/graph-view.md accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Hey @kmcginnes, Thank you for merging the node-styling! I refactored the simple conditional styling PR I had to use the latest and put it up as a direct PR and closed mine. Style import and Export as you have it works and brings along the conditional styling as well. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Adds an optional conditional style per vertex and edge type. When a rendered entity's attribute satisfies a condition, an alternate style is layered on top of the base style — useful for flagging states (e.g. a
Personnode withknown_bad = true) without defining a separate type.=,!=,>,<,>=,<=) + value. Comparison is type-aware and evaluated in JavaScript at render time: numeric when both sides are numbers, chronological when both parse as dates (handles ISO and non-ISO formats likeM/D/YYYY), lexicographic otherwise. Matching is exposed to Cytoscape via aconditionMetflag rather than Cytoscape's value-selector operators, which compare lexicographically / viaparseFloatand mishandle dates.Validation
pnpm checkspasses with no errors;pnpm testpasses (2102 tests).M/D/YYYY) date, and boolean conditions.Related Issues
Related to #1785 (property-based node styling). This is a partial step: it covers the single-condition case — differentiating entities that meet one condition (e.g.
known_bad = true, orrisk_score > 90→ red) — which handles the fraud use case the issue leads with. It does not yet cover the issue's other examples: mapping one property to several distinct icons (e.g. gender → distinct icons) or mapping a numeric property to a color gradient. Those would be follow-on work.Check List
pnpm checkspasses with no errors.pnpm testpasses with no failures.🤖 Generated with Claude Code