Class: ErdMap::GraphRenderer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/erd_map/graph_renderer.rb

Constant Summary collapse

VISIBLE =
1.0
TRANSLUCENT =
0.01
HIGHLIGHT_NODE_COLOR =
"black"
HIGHLIGHT_EDGE_COLOR =
"orange"
HIGHLIGHT_TEXT_COLOR =
"white"
BASIC_COLOR =
"darkslategray"
EMPHASIS_NODE_SIZE =
80

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#graph_rendererObject (readonly)

Returns the value of attribute graph_renderer.



8
9
10
# File 'lib/erd_map/graph_renderer.rb', line 8

def graph_renderer
  @graph_renderer
end

Instance Method Details

#cardinality_labelObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/erd_map/graph_renderer.rb', line 22

def cardinality_label
  bokeh_models.LabelSet.new(
    x: "x",
    y: "y",
    text: "text",
    source: cardinality_data_source,
    text_font_size: "12pt",
    text_color: "text_color",
    text_alpha: { field: "alpha" },
  )
end

#js_args(plot) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/erd_map/graph_renderer.rb', line 34

def js_args(plot)
  {
    graphRenderer: graph_renderer,
    rectRenderer: rect_renderer,
    circleRenderer: circle_renderer,
    layoutProvider: layout_provider,
    cardinalityDataSource: cardinality_data_source,
    connectionsData: graph.connections.to_json,
    layoutsByChunkData: graph.layouts_by_chunk.to_json,
    chunkedNodesData: graph.chunked_nodes.to_json,
    nodeWithCommunityIndexData: graph.node_with_community_index.to_json,
    searchBox: plot.search_box,
    selectingNodeLabel: plot.selecting_node_label,
    zoomModeToggle: plot.zoom_mode_toggle,
    tapModeToggle: plot.tap_mode_toggle,
    displayTitleModeToggle: plot.display_title_mode_toggle,
    nodeLabels: {
      titleModelLabel: title_model_label,
      foreignModelLabel: foreign_model_label,
      foreignColumnsLabel: foreign_columns_label,
    },
    plot: plot.plot,
    VISIBLE: VISIBLE,
    TRANSLUCENT: TRANSLUCENT,
    HIGHLIGHT_NODE_COLOR: HIGHLIGHT_NODE_COLOR,
    HIGHLIGHT_EDGE_COLOR: HIGHLIGHT_EDGE_COLOR,
    HIGHLIGHT_TEXT_COLOR: HIGHLIGHT_TEXT_COLOR,
    BASIC_COLOR: BASIC_COLOR,
    EMPHASIS_NODE_SIZE: EMPHASIS_NODE_SIZE,
  }
end

#renderersObject



18
19
20
# File 'lib/erd_map/graph_renderer.rb', line 18

def renderers
  [circle_renderer, rect_renderer]
end