2019-08-04 11:39:29 +00:00
|
|
|
import { INSTANCE_TYPES } from "./constants";
|
|
|
|
|
2020-05-19 13:45:27 +00:00
|
|
|
interface ColorSchemeBase {
|
2019-07-24 15:51:44 +00:00
|
|
|
// The name of the coloring, e.g. "Instance type"
|
|
|
|
name: string;
|
|
|
|
// The name of the key in a cytoscape node's `data` field to color by.
|
|
|
|
// For example, use cytoscapeDataKey: "type" to color according to type.
|
|
|
|
cytoscapeDataKey: string;
|
2019-07-27 17:58:40 +00:00
|
|
|
description?: string;
|
|
|
|
type: "qualitative" | "quantitative";
|
|
|
|
}
|
2020-05-19 13:45:27 +00:00
|
|
|
interface QualitativeColorScheme extends ColorSchemeBase {
|
2019-07-24 15:51:44 +00:00
|
|
|
// The values the color scheme is used for. E.g. ["mastodon", "pleroma", "misskey"].
|
|
|
|
values: string[];
|
2019-07-27 17:58:40 +00:00
|
|
|
type: "qualitative";
|
|
|
|
}
|
2020-05-19 13:45:27 +00:00
|
|
|
interface QuantitativeColorScheme extends ColorSchemeBase {
|
2019-07-27 17:58:40 +00:00
|
|
|
type: "quantitative";
|
|
|
|
exponential: boolean;
|
2019-07-24 15:51:44 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 13:45:27 +00:00
|
|
|
export type ColorScheme = QualitativeColorScheme | QuantitativeColorScheme;
|
2019-07-27 17:58:40 +00:00
|
|
|
|
2020-05-19 13:45:27 +00:00
|
|
|
export const typeColorScheme: QualitativeColorScheme = {
|
2019-07-24 15:51:44 +00:00
|
|
|
cytoscapeDataKey: "type",
|
|
|
|
name: "Instance type",
|
2019-07-27 17:58:40 +00:00
|
|
|
type: "qualitative",
|
2020-05-19 13:45:27 +00:00
|
|
|
values: INSTANCE_TYPES,
|
2019-07-24 15:51:44 +00:00
|
|
|
};
|
2020-05-19 13:45:27 +00:00
|
|
|
export const activityColorScheme: QuantitativeColorScheme = {
|
2019-07-27 17:58:40 +00:00
|
|
|
cytoscapeDataKey: "statusesPerDay",
|
2019-08-15 14:35:40 +00:00
|
|
|
description: "The average number of statuses posted per day. This is an exponential scale.",
|
2019-07-27 17:58:40 +00:00
|
|
|
exponential: true,
|
2019-08-15 14:35:40 +00:00
|
|
|
name: "Activity",
|
2020-05-19 13:45:27 +00:00
|
|
|
type: "quantitative",
|
2019-07-27 17:58:40 +00:00
|
|
|
};
|
2019-07-24 15:51:44 +00:00
|
|
|
|
2020-05-19 13:45:27 +00:00
|
|
|
export const colorSchemes: ColorScheme[] = [typeColorScheme, activityColorScheme];
|