/
settings.py
248 lines (236 loc) · 8.05 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# -*- coding: utf-8 -*-
"""
flask_jsondash.settings
~~~~~~~~~~~~~~~~~~~~~~~
App/blueprint wide settings.
:copyright: (c) 2016 by Chris Tabor.
:license: MIT, see LICENSE for more details.
"""
import os
# DB Settings - Defaults to values specific for Mongo,
# but Postgresql is also supported.
DB_URI = os.environ.get('CHARTS_DB_HOST', 'localhost')
DB_PORT = int(os.environ.get('CHARTS_DB_PORT', 27017))
DB_NAME = os.environ.get('CHARTS_DB_DB', 'charts')
# This name is used for table/collection,
# regardless of Postgresql or Mongodb usage.
DB_TABLE = os.environ.get('CHARTS_DB_TABLE', 'views')
ACTIVE_DB = os.environ.get('CHARTS_ACTIVE_DB', 'mongo').lower()
"""
Chart configuration below -- this is essential to making the frontend work.
Default values have been added, but you can change them by importing your
own override (see bottom).
Configuration:
'charts' is a list of 2-tuples, where:
1. The first index is the type -- this MUST NOT CHANGE!
2. The second index is the label -- This is configurable.
'css_url'/'js_url' can be relative or absolute paths.
"""
CHARTS_CONFIG = {
'C3': {
'charts': [
('line', 'Line chart'),
('bar', 'Bar chart'),
('timeseries', 'Timeseries chart'),
('step', 'Step chart'),
('pie', 'Pie chart'),
('area', 'Area chart'),
('donut', 'Donut chart'),
('spline', 'Spline chart'),
('gauge', 'Gauge chart'),
('scatter', 'Scatter chart'),
('area-spline', 'Area spline chart'),
],
'dependencies': ['D3'],
'js_url': ['//cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.js'],
'css_url': ['//cdnjs.cloudflare.com/ajax/libs/c3/0.4.11/c3.min.css'],
'enabled': True,
'help_link': 'http://c3js.org/reference.html',
},
'D3': {
'charts': [
('radial-dendrogram', 'Radial Dendrogram'),
('dendrogram', 'Dendrogram'),
('treemap', 'Treemap'),
('voronoi', 'Voronoi'),
('circlepack', 'Circle Pack'),
],
'dependencies': [],
'js_url': ['//cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.min.js'],
'css_url': [],
'enabled': True,
'help_link': 'https://github.com/d3/d3/wiki',
},
'FlameGraph': {
'charts': [
('flamegraph', 'Flame Graph'),
],
'dependencies': ['D3'],
'js_url': [
'//spiermar.github.io/d3-flame-graph/d3.flameGraph.js',
'//labratrevenge.com/d3-tip/javascripts/d3.tip.v0.6.3.js'
],
'css_url': ['//spiermar.github.io/d3-flame-graph/d3.flameGraph.css'],
'enabled': True,
'help_link': 'https://github.com/spiermar/d3-flame-graph',
},
'WordCloud': {
'charts': [
('wordcloud', 'Word Cloud'),
],
'js_url': [
('//cdnjs.cloudflare.com/ajax/libs/d3-cloud/1.2.4/'
'd3.layout.cloud.min.js'),
],
'css_url': [],
'enabled': True,
'dependencies': ['D3'],
'help_link': 'https://github.com/jasondavies/d3-cloud',
},
'Basic': {
'charts': [
('custom', 'Custom direct loading of any arbitrary html.'),
('iframe', 'Embedded iframe.'),
('image', 'Image (inline embed)'),
('numbergroup', ('Group of numbers with titles '
'representing some aggregate values for '
'each column.')),
('number', ('Single number (size autoscaled) representing '
'some aggregate value.')),
('youtube', 'YouTube video embedded as an iframe.'),
],
'dependencies': [],
'js_url': [],
'css_url': [],
'enabled': True,
'help_link': ('https://github.com/christabor/flask_jsondash/blob/'
'master/docs/schemas.md'),
},
'Vega': {
'charts': [
('vega-lite', 'vega-lite specification.'),
],
'dependencies': ['D3'],
'js_url': [
('//cdnjs.cloudflare.com/ajax/libs/vega/2.6.5/vega.min.js'),
('//cdnjs.cloudflare.com/ajax/libs/vega-lite/'
'1.3.1/vega-lite.min.js'),
('//cdnjs.cloudflare.com/ajax/libs/vega-embed/'
'2.2.0/vega-embed.min.js'),
],
'css_url': [],
'enabled': True,
'help_link': 'https://vega.github.io/vega-lite/docs',
},
'DataTable': {
'charts': [
('datatable', 'A table of data, with sorting and filtering.'),
],
'dependencies': [],
'js_url': [
('//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/'
'jquery.dataTables.min.js'),
('//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.10/js/'
'dataTables.bootstrap.min.js')
],
'css_url': [
('//cdnjs.cloudflare.com/ajax/libs/datatables/1.10.10/css/'
'dataTables.bootstrap.min.css'),
],
'enabled': True,
'help_link': 'https://datatables.net/reference/index',
},
'Timeline': {
'charts': [
('timeline', 'A timeline.js timeline'),
],
'dependencies': [],
'js_url': ['//cdn.knightlab.com/libs/timeline3/latest/js/timeline.js'],
'css_url': [
'//cdn.knightlab.com/libs/timeline3/latest/css/timeline.css'],
'enabled': True,
'help_link': 'https://timeline.knightlab.com/docs/',
},
'Venn': {
'charts': [
('venn', 'A venn.js Venn or Euler diagram'),
],
'dependencies': ['D3'],
'js_url': ['//cdn.rawgit.com/benfred/venn.js/master/venn.js'],
'css_url': [],
'enabled': True,
'help_link': 'https://github.com/benfred/venn.js/',
},
'SigmaJS': {
'charts': [
('sigma', 'SigmaJS default json based graph'),
],
'dependencies': [],
'js_url': [
'//cdnjs.cloudflare.com/ajax/libs/sigma.js/1.2.0/sigma.min.js',
],
'css_url': [],
'enabled': True,
'help_link': 'http://sigmajs.org',
},
'Cytoscape': {
'charts': [
('cytoscape', ('Cytoscape compatible json configuration '
'(core layouts only).')),
],
'dependencies': [],
'js_url': [
('//cdnjs.cloudflare.com/ajax/libs/cytoscape/'
'3.1.0/cytoscape.min.js'),
],
'css_url': [],
'enabled': True,
'help_link': 'http://js.cytoscape.org/',
},
'Graph': {
'charts': [
('graph', 'Graph using the graphviz .dot specification'),
],
'dependencies': ['D3'],
'js_url': [
('//cdnjs.cloudflare.com/ajax/libs/'
'dagre-d3/0.4.17/dagre-d3.min.js'),
('//raw.githubusercontent.com/cpettitt/graphlib-dot/'
'master/dist/graphlib-dot.min.js'),
],
'css_url': [],
'enabled': True,
'help_link': 'https://github.com/cpettitt/dagre-d3/wiki',
},
'Sparklines': {
'charts': [
('sparklines-line', 'Sparkline Line'),
('sparklines-bar', 'Sparkline Bar'),
('sparklines-tristate', 'Sparkline Tristate'),
('sparklines-discrete', 'Sparkline Discrete'),
('sparklines-bullet', 'Sparkline Bullet'),
('sparklines-pie', 'Sparkline Pie'),
('sparklines-box', 'Sparkline Box'),
],
'dependencies': [],
'js_url': [
('//cdnjs.cloudflare.com/ajax/libs/jquery-sparklines/'
'2.1.2/jquery.sparkline.min.js'),
],
'css_url': [],
'enabled': True,
'help_link': 'http://omnipotent.net/jquery.sparkline/#s-docs',
},
'PlotlyStandard': {
'charts': [
('plotly-any', 'Plotly serializable specification'),
],
'dependencies': [],
'js_url': [
'//cdn.plot.ly/plotly-latest.min.js',
],
'css_url': [],
'enabled': True,
'help_link': 'https://plot.ly/javascript/',
},
}