mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-10 08:38:28 +00:00
chg: [chord] add parameters to filtersby min and max value
This commit is contained in:
parent
de1342527f
commit
de46838811
2 changed files with 16 additions and 3 deletions
15
var/www/static/js/d3/chord_directed_diagram.js
vendored
15
var/www/static/js/d3/chord_directed_diagram.js
vendored
|
@ -6,7 +6,20 @@
|
||||||
|
|
||||||
// TODO: - Mouseover object
|
// 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) {
|
function getMaxCharsToShow(angle, radius) {
|
||||||
const approximateCharWidth = 7; // Approximate width of a character in pixels
|
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 %}"
|
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) {
|
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 %}"
|
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) {
|
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 a new issue