chg: [chord] add parameters to filtersby min and max value

This commit is contained in:
terrtia 2024-06-24 14:44:47 +02:00
parent de1342527f
commit de46838811
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 16 additions and 3 deletions

View file

@ -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

View file

@ -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);
}); });