mirror of https://github.com/CIRCL/AIL-framework
chg: [chord] add parameters to filtersby min and max value
parent
de1342527f
commit
de46838811
|
@ -6,7 +6,20 @@
|
|||
|
||||
// TODO: - Mouseover object
|
||||
|
||||
const create_directed_chord_diagram = (container_id, data, fct_mouseover, fct_mouseout, options) => {
|
||||
const create_directed_chord_diagram = (container_id, data, min_value= 0, max_value = -1, fct_mouseover, fct_mouseout, options) => {
|
||||
|
||||
// Filter data by value between target and source
|
||||
if (min_value > 0) {
|
||||
data.data = data.data.filter(function(value) {
|
||||
return data.value >= min_value;
|
||||
});
|
||||
}
|
||||
if (max_value > 0) {
|
||||
data.data = data.data.filter(function(value) {
|
||||
return data.value <= max_value;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getMaxCharsToShow(angle, radius) {
|
||||
const approximateCharWidth = 7; // Approximate width of a character in pixels
|
||||
|
|
|
@ -386,12 +386,12 @@ $(document).ready(function(){
|
|||
|
||||
let url = "{{ url_for('correlation.relationships_chord_graph_json') }}?id={{ dict_object["correlation_id"] }}&type={{ dict_object["object_type"] }}{% if 'type_id' in dict_object["metadata"] %}&subtype={{ dict_object["metadata"]["type_id"] }}{% endif %}"
|
||||
d3.json(url).then(function(data) {
|
||||
create_directed_chord_diagram('#chart_test', data, mouseover_tooltip_ail_obj, mouseout_tooltip_ail_obj);
|
||||
create_directed_chord_diagram('#chart_test', data, 0, -1, mouseover_tooltip_ail_obj, mouseout_tooltip_ail_obj);
|
||||
});
|
||||
|
||||
let url2 = "{{ url_for('correlation.relationships_chord_mentions_graph_json') }}?id={{ dict_object["correlation_id"] }}&type={{ dict_object["object_type"] }}{% if 'type_id' in dict_object["metadata"] %}&subtype={{ dict_object["metadata"]["type_id"] }}{% endif %}"
|
||||
d3.json(url2).then(function(data) {
|
||||
create_directed_chord_diagram('#chart_mentions', data, mouseover_tooltip_ail_obj, mouseout_tooltip_ail_obj);
|
||||
create_directed_chord_diagram('#chart_mentions', data, 0, -1, mouseover_tooltip_ail_obj, mouseout_tooltip_ail_obj);
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue