remove color-coding by activity per user

This commit is contained in:
Tao Bror Bojlén 2019-08-15 16:35:40 +02:00
parent fc836256ba
commit 4a7804d987
No known key found for this signature in database
GPG key ID: C6EC7AAB905F9E6F
3 changed files with 9 additions and 37 deletions

View file

@ -11,23 +11,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Cleaned up ElasticSearch configuration in backend.
### Deprecated ### Deprecated
### Removed ### Removed
### Fixed - Remove color-coding by activity per user.
- Cleaned up ElasticSearch configuration in backend. ### Fixed
## [2.6.1 - 2019-08-10] ## [2.6.1 - 2019-08-10]
### Fixed ### Changed
- Added missing indices on `crawls` and `crawl_interactions` tables. - Added missing indices on `crawls` and `crawl_interactions` tables.
- Added table to store most recent crawl. This speeds up the instance view by a lot! - Added table to store most recent crawl. This speeds up the instance view by a lot!
### Security
## [2.6.0 - 2019-08-10] ## [2.6.0 - 2019-08-10]
### Added ### Added

View file

@ -8,15 +8,6 @@ defmodule BackendWeb.GraphView do
|> Enum.map(fn %{statuses_per_day: statuses_per_day} -> statuses_per_day end) |> Enum.map(fn %{statuses_per_day: statuses_per_day} -> statuses_per_day end)
|> Enum.filter(fn s -> s != nil end) |> Enum.filter(fn s -> s != nil end)
statuses_per_user_per_day =
nodes
|> Enum.filter(fn %{statuses_per_day: statuses_per_day, user_count: user_count} ->
statuses_per_day != nil and user_count != nil and user_count > 0
end)
|> Enum.map(fn %{statuses_per_day: statuses_per_day, user_count: user_count} ->
statuses_per_day / user_count
end)
%{ %{
graph: %{ graph: %{
nodes: render_many(nodes, GraphView, "node.json", as: :node), nodes: render_many(nodes, GraphView, "node.json", as: :node),
@ -28,10 +19,6 @@ defmodule BackendWeb.GraphView do
statusesPerDay: [ statusesPerDay: [
Enum.min(statuses_per_day, fn -> nil end), Enum.min(statuses_per_day, fn -> nil end),
Enum.max(statuses_per_day, fn -> nil end) Enum.max(statuses_per_day, fn -> nil end)
],
statusesPerUserPerDay: [
Enum.min(statuses_per_user_per_day, fn -> nil end),
Enum.max(statuses_per_user_per_day, fn -> nil end)
] ]
} }
} }
@ -45,13 +32,6 @@ defmodule BackendWeb.GraphView do
false -> 1 false -> 1
end end
statuses_per_user_per_day =
if node.statuses_per_day != nil and node.user_count != nil and node.user_count > 0 do
node.statuses_per_day / node.user_count
else
nil
end
# This is the format that cytoscape.js expects. # This is the format that cytoscape.js expects.
%{ %{
data: %{ data: %{
@ -59,8 +39,7 @@ defmodule BackendWeb.GraphView do
label: node.domain, label: node.domain,
size: size, size: size,
type: node.type, type: node.type,
statusesPerDay: node.statuses_per_day, statusesPerDay: node.statuses_per_day
statusesPerUserPerDay: statuses_per_user_per_day
}, },
position: %{ position: %{
x: node.x, x: node.x,

View file

@ -29,17 +29,10 @@ export const typeColorScheme: IQualitativeColorScheme = {
}; };
export const activityColorScheme: IQuantitativeColorScheme = { export const activityColorScheme: IQuantitativeColorScheme = {
cytoscapeDataKey: "statusesPerDay", cytoscapeDataKey: "statusesPerDay",
description: "The average number of statuses posted per day. Note that this is colored by an exponential scale.", description: "The average number of statuses posted per day. This is an exponential scale.",
exponential: true, exponential: true,
name: "Activity (total)", name: "Activity",
type: "quantitative"
};
export const activityPerUserColorScheme: IQuantitativeColorScheme = {
cytoscapeDataKey: "statusesPerUserPerDay",
description: "The average number of statuses posted per person per day.",
exponential: false,
name: "Activity (per person)",
type: "quantitative" type: "quantitative"
}; };
export const colorSchemes: IColorScheme[] = [typeColorScheme, activityColorScheme, activityPerUserColorScheme]; export const colorSchemes: IColorScheme[] = [typeColorScheme, activityColorScheme];