|
| 1 | +# Filter API Documentation |
| 2 | + |
| 3 | +Here you can find documentation for Filter API of Ideal Graph Visualizer. |
| 4 | +Custom filters are powerful tool which let you write your own code in JavaScript |
| 5 | +to allow almost unbound manipulation and analysis of GraalVM graphs in Ideal Graph Visualizer. |
| 6 | + |
| 7 | +## Helpers |
| 8 | + |
| 9 | +Our Filter API comes with various prepared helper functions to speedup writing of your own filters, |
| 10 | +helpers are written against [imported classes](#imported-classes) listed below. |
| 11 | + |
| 12 | +- `classSimpleName(className: string): string;` |
| 13 | +returns regexp for easier matching of "class" property to class name (matches all namespaces)<p> </p> |
| 14 | +- `colorize(propertyName: string, valueRegexp: string, color: Color);` |
| 15 | +colorizes nodes with matching property value to a color, |
| 16 | +there are already prepared [colors](#global-colors) in [global variables](#global-variables): |
| 17 | +-- black, white, gray, darkGray, lightGray, red, green, blue, cyan, magenta, yellow, orange, pink |
| 18 | +or you can create your own (viz [imported classes](#imported-classes)): `var color = new Color(r, g, b);`<p> </p> |
| 19 | +- `colorizeGradient(propertyName: string, min: number, max: number);` |
| 20 | +colorizes nodes with property in gradient manner on interval \[min, max\] (expects value to be a number) |
| 21 | +default coloring goes from `blue` through `yellow` to `red` in linear fassion.<p> </p> |
| 22 | +- `colorizeGradientWithMode(propertyName: string, min: number, max: number, gradientMode: string);` |
| 23 | +allows to set traversion between colors to either `"LINEAR"` or `"LOGARITHMIC"` mode.<p> </p> |
| 24 | +- `colorizeGradientCustom(propertyName: string, min: number, max: number, gradientMode: string, colors: Color[], fractions: number[], shades: integer);` |
| 25 | +allows to further specify: |
| 26 | +-- `colors`: used colors in order from minimal to maximal value |
| 27 | +-- `fractions`: positions of abovementioned colors on color gradient scale (first is 0, last 1) |
| 28 | +-- `shades`: number of used color shades<p> </p> |
| 29 | +- `remove(propertyName: string, valueRegexp: string);` |
| 30 | +removes nodes with matching property value<p> </p> |
| 31 | +- `removeIncludingOrphans(propertyName: string, valueRegexp: string);` |
| 32 | +removes nodes with matching property value and possible orphaned nodes<p> </p> |
| 33 | +- `removeInputs(propertyName: string, valueRegexp: string, fromIndex: integer = 0, toIndex: integer = Integer.MAX_VALUE);` |
| 34 | +removes input connections of nodes with matching property value |
| 35 | +-- `fromIndex` and `toIndex` denotes starting and ending index of inputs to remove<p> </p> |
| 36 | +- `removeUnconectedSlots(removeInputs: boolean, removeOutputs: boolean);` |
| 37 | +removes input/output slots that doesn't have a connection<p> </p> |
| 38 | +- `split(propertyName: string, valueRegexp: string, nodeText: string);` |
| 39 | +removes nodes with matching property value and turns them into names slots on predecessor and successor nodes |
| 40 | +-- node text allow to extract and use property values as name text by format: "[propertyName]" |
| 41 | + |
| 42 | +## <a name=global-variables></a>Defined global variables |
| 43 | + |
| 44 | +### <a name=global-colors></a>Colors |
| 45 | + |
| 46 | +|Variable name|Content| |
| 47 | +|:----:|:----:| |
| 48 | +|black|Color.static.black| |
| 49 | +|blue|Color.static.blue| |
| 50 | +|cyan|Color.static.cyan| |
| 51 | +|darkGray|Color.static.darkGray| |
| 52 | +|gray|Color.static.gray| |
| 53 | +|green|Color.static.green| |
| 54 | +|lightGray|Color.static.lightGray| |
| 55 | +|magenta|Color.static.magenta| |
| 56 | +|orange|Color.static.orange| |
| 57 | +|pink|Color.static.pink |
| 58 | +|red|Color.static.red| |
| 59 | +|yellow|Color.static.yellow| |
| 60 | +|white|Color.static.white| |
| 61 | + |
| 62 | +### <a name=global-others></a>Others |
| 63 | + |
| 64 | +|Variable name|Content|Description| |
| 65 | +|:----:|:----:|:----:| |
| 66 | +|IO|PrintStream|output stream| |
| 67 | +|graph|Diagram|current graph| |
| 68 | + |
| 69 | +## <a name=imported-classes></a>Imported classes |
| 70 | + |
| 71 | +Classes imported from Ideal Graph Visualizer Java codebase to allow their creation. |
| 72 | + |
| 73 | +|JS Class|Java Class| |
| 74 | +|:----:|:----:| |
| 75 | +|Color|java.awt.Color| |
| 76 | +||| |
| 77 | +|GraphDocument|org.graalvm.visualizer.data.GraphDocument| |
| 78 | +|InputGraph|org.graalvm.visualizer.data.InputGraph| |
| 79 | +||| |
| 80 | +|Diagram|org.graalvm.visualizer.graph.Diagram| |
| 81 | +|Block|org.graalvm.visualizer.graph.Block| |
| 82 | +|Figure|org.graalvm.visualizer.graph.Figure| |
| 83 | +|FigureSource|org.graalvm.visualizer.graph.FigureSource| |
| 84 | +|InputSlot|org.graalvm.visualizer.graph.InputSlot| |
| 85 | +|OutputSlot|org.graalvm.visualizer.graph.OutputSlot| |
| 86 | +|Connection|org.graalvm.visualizer.graph.Connection| |
| 87 | +||| |
| 88 | +|MatcherSelector|org.graalvm.visualizer.graph.MatcherSelector| |
| 89 | +|InvertSelector|org.graalvm.visualizer.graph.InvertSelector| |
| 90 | +|AndSelector|org.graalvm.visualizer.graph.AndSelector| |
| 91 | +|OrSelector|org.graalvm.visualizer.graph.OrSelector| |
| 92 | +|PredecessorSelector|org.graalvm.visualizer.graph.PredecessorSelector| |
| 93 | +|SuccessorSelector|org.graalvm.visualizer.graph.SuccessorSelector| |
| 94 | +||| |
| 95 | +|Properties|org.graalvm.visualizer.data.Properties| |
| 96 | +|Property|org.graalvm.visualizer.data.Property| |
| 97 | +||| |
| 98 | +|PropertySelector|org.graalvm.visualizer.data.Properties$PropertySelector| |
| 99 | +|RegexpPropertyMatcher|org.graalvm.visualizer.data.Properties$RegexpPropertyMatcher| |
| 100 | +|EqualityPropertyMatcher|org.graalvm.visualizer.data.Properties$EqualityPropertyMatcher| |
| 101 | +|InvertPropertyMatcher|org.graalvm.visualizer.data.Properties$InvertPropertyMatcher| |
| 102 | +||| |
| 103 | +|ColorFilter|org.graalvm.visualizer.filter.ColorFilter| |
| 104 | +|ColorRule|org.graalvm.visualizer.filter.ColorFilter$ColorRule| |
| 105 | +|CombineFilter|org.graalvm.visualizer.filter.CombineFilter| |
| 106 | +|ConnectionFilter|org.graalvm.visualizer.filter.ConnectionFilter| |
| 107 | +|CustomFilter|org.graalvm.visualizer.filter.CustomFilter| |
| 108 | +|EdgeColorIndexFilter|org.graalvm.visualizer.filter.EdgeColorIndexFilter| |
| 109 | +|GradientColorFilter|org.graalvm.visualizer.filter.GradientColorFilter| |
| 110 | +|RemoveFilter|org.graalvm.visualizer.filter.RemoveFilter| |
| 111 | +|RemoveRule|org.graalvm.visualizer.filter.RemoveFilter$RemoveRule| |
| 112 | +|RemoveInputsFilter|org.graalvm.visualizer.filter.RemoveInputsFilter| |
| 113 | +|RemoveInputsRule|org.graalvm.visualizer.filter.RemoveInputsFilter$RemoveInputsRule| |
| 114 | +|RemoveSelfLoopsFilter|org.graalvm.visualizer.filter.RemoveSelfLoopsFilter| |
| 115 | +|SplitFilter|org.graalvm.visualizer.filter.SplitFilter| |
| 116 | +|UnconnectedSlotFilter|org.graalvm.visualizer.filter.UnconnectedSlotFilter| |
0 commit comments