Commit 3f41e9df authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Remove obsolete controller/view graph_extjs.

parent 71a97705
......@@ -24,37 +24,6 @@ MSG = T(" - %s entry(ies) modified in the history table. <br>"
MSG_CVT = T(" - Conversion error: %s.")
def graph_extjs():
"""Plot 2D metric as a C{Ext.char.series.Area} using the ExtJS library.
This action is kept as a test bench of ExtJS chart classes.
Deprecated: use the more generic graph_mpl
"""
ui_table = virtdb.selector
selector = EvtSelector(ui_table, exclude_fields=("metric",))
# homomorphism between metric2D and graph
config = db.graphs[request.vars.id_graphs]
config.group_field_y = config.field_horizontal
config.group_field_x = config.field_stacked
config.metric_field_z = "people.id"
config.aggregation_z = "size"
# generate the metric according to user specification
report = Metric2D(config, selector)
# extract the configurations for the Ext.data.Store
store = report.to_store()
# Extra the stack keys (value for metric.field_vertical)
stack_keys = [el for el in report.df.columns]
# delegate the rendering of the graph to the view
return dict(cfg_store=json.dumps(store), stack_keys=stack_keys, view=config)
def graph_mpl():
"""Plot list or metric using the matplotlib library
......
......@@ -14,6 +14,7 @@ HEAD
- Rename the class MySelector as EvtSelector.
- Add the method EvtSelector._active_period to compute properly
EvtSelector._is_start, _is_end as well as is_over.
- Remove the obsolete controller and view, graph_extjs.
- Factorize the application around the plugin_event.
0.6.2 (Nov 2016)
......
{{
#--------------------------------------------------------------------------
#
# The python controller return the variables:
# - cfg_store (string)
# - stack_keys (list)
# - view (Storage)
#
#--------------------------------------------------------------------------
#
# prepare the data
# - build unique DIV identifier
# - Title and DIV block
#
#--------------------------------------------------------------------------
import json
#
# unique identifier for the DIV block associated to the grid
#
divchart = "chart-%s" % id(cfg_store)
response.write(H2(view.title, _class="dbui-h2 dbui-small-cap"))
response.write(DIV(_id=divchart))
#
# Export python variables to the javascript
#
jsvars = ["axes",
"cfgStore = %s" % cfg_store,
"chart",
"divchart = '%s'" % divchart,
"series",
"seriesKeys = %s" % json.dumps(stack_keys)]
jsvars = " var %s;" % ',\n'.join(jsvars)
response.write(SCRIPT(jsvars), escape=False)
}}
<script>
// the axes
axes = [{
type: 'Numeric',
fields: seriesKeys,
grid: true,
minimum: 0,
minorTickSteps: 1,
position: 'left'
}, {
type: 'Category',
fields: ['year'],
grid: true,
label: {
rotate: {
degrees: 270
}
},
position: 'bottom'
}];
// how to display the series
series = [{
type: 'area',
//type: 'column',
style: {
opacity: 0.8
},
xField: 'group',
yField: seriesKeys
}];
// instantiate the chart
chart = Ext.create('Ext.chart.Chart', {
axes: axes,
legend: {
labelFont: '8px Helvetica, sans-serif',
position: 'right'
},
series: series,
store: cfgStore,
width: 600,
height: 400,
renderTo: divchart
});
// inhibit context menu on the rest of the panel
chart.getEl().up('.x-panel-body').on('contextmenu', function(event) {
event.stopEvent();
});
</script>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment