diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/build_options b/exploratory/rMorton/.Rproj.user/C5F3700/build_options deleted file mode 100644 index 7e9daa4..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/build_options +++ /dev/null @@ -1,7 +0,0 @@ -auto_roxygenize_for_build_and_reload="0" -auto_roxygenize_for_build_package="1" -auto_roxygenize_for_check="1" -live_preview_website="1" -makefile_args="" -preview_website="1" -website_output_format="all" diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/console06/INDEX001 b/exploratory/rMorton/.Rproj.user/C5F3700/console06/INDEX001 deleted file mode 100644 index 0637a08..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/console06/INDEX001 +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/debug-breakpoints.pper b/exploratory/rMorton/.Rproj.user/C5F3700/pcs/debug-breakpoints.pper deleted file mode 100644 index 5528aea..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/debug-breakpoints.pper +++ /dev/null @@ -1,6 +0,0 @@ -{ - "debugBreakpointsState" : { - "breakpoints" : [ - ] - } -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/files-pane.pper b/exploratory/rMorton/.Rproj.user/C5F3700/pcs/files-pane.pper deleted file mode 100644 index 25648ac..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/files-pane.pper +++ /dev/null @@ -1,9 +0,0 @@ -{ - "path" : "~/GitHub/research/exploratory/rMorton", - "sortOrder" : [ - { - "ascending" : true, - "columnIndex" : 2 - } - ] -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/packages-pane.pper b/exploratory/rMorton/.Rproj.user/C5F3700/pcs/packages-pane.pper deleted file mode 100644 index 20751f2..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/packages-pane.pper +++ /dev/null @@ -1,7 +0,0 @@ -{ - "installOptions" : { - "installDependencies" : true, - "installFromRepository" : true, - "libraryPath" : "C:/Users/Morton/Documents/R/win-library/3.5" - } -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/source-pane.pper b/exploratory/rMorton/.Rproj.user/C5F3700/pcs/source-pane.pper deleted file mode 100644 index 70829f6..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/source-pane.pper +++ /dev/null @@ -1,3 +0,0 @@ -{ - "activeTab" : 1 -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/windowlayoutstate.pper b/exploratory/rMorton/.Rproj.user/C5F3700/pcs/windowlayoutstate.pper deleted file mode 100644 index 307e3ba..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/windowlayoutstate.pper +++ /dev/null @@ -1,14 +0,0 @@ -{ - "left" : { - "panelheight" : 937, - "splitterpos" : 348, - "topwindowstate" : "NORMAL", - "windowheight" : 975 - }, - "right" : { - "panelheight" : 937, - "splitterpos" : 585, - "topwindowstate" : "NORMAL", - "windowheight" : 975 - } -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/workbench-pane.pper b/exploratory/rMorton/.Rproj.user/C5F3700/pcs/workbench-pane.pper deleted file mode 100644 index 0e24b84..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/pcs/workbench-pane.pper +++ /dev/null @@ -1,6 +0,0 @@ -{ - "TabSet1" : 0, - "TabSet2" : 0, - "TabZoom" : { - } -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/rmd-outputs b/exploratory/rMorton/.Rproj.user/C5F3700/rmd-outputs deleted file mode 100644 index ab4eede..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/rmd-outputs +++ /dev/null @@ -1,8 +0,0 @@ -~/GitHub/research/exploratory/rMorton/sc_eda_doc.html -~/GitHub/research/exploratory/rMorton/sc_eda_doc.html -~/GitHub/research/exploratory/rMorton/sc_eda_doc.html - -~/GitHub/research/exploratory/rMorton/sc_eda_doc.html - - - diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/saved_source_markers b/exploratory/rMorton/.Rproj.user/C5F3700/saved_source_markers deleted file mode 100644 index 2b1bef1..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/saved_source_markers +++ /dev/null @@ -1 +0,0 @@ -{"active_set":"","sets":[]} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/37EAAA2C b/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/37EAAA2C deleted file mode 100644 index b90579c..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/37EAAA2C +++ /dev/null @@ -1,23 +0,0 @@ -{ - "collab_server" : "", - "contents" : "", - "created" : 1554834200896.000, - "dirty" : false, - "encoding" : "UTF-8", - "folds" : "18|27|174|0|\n", - "hash" : "3466968790", - "id" : "37EAAA2C", - "lastKnownWriteTime" : 1554847995, - "last_content_update" : 1554847995531, - "path" : "~/GitHub/research/exploratory/rMorton/sc_eda_doc.Rmd", - "project_path" : "sc_eda_doc.Rmd", - "properties" : { - "cursorPosition" : "236,98", - "scrollLine" : "235", - "tempName" : "Untitled1" - }, - "relative_order" : 2, - "source_on_save" : false, - "source_window" : "", - "type" : "r_markdown" -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/37EAAA2C-contents b/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/37EAAA2C-contents deleted file mode 100644 index 17c9304..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/37EAAA2C-contents +++ /dev/null @@ -1,267 +0,0 @@ ---- -title: "Source Cred EDA" -author: "Ryan Morton, Morton Analytics" -date: "April 9, 2019" -output: - html_document: - toc: true - toc_float: true ---- - - - -```{r setup, include=FALSE} -knitr::opts_chunk$set(echo = FALSE) -library(jsonlite) -library(rvest) -library(xml2) -library(tidyr) -library(dplyr) -library(purrr) -library(tidytext) -library(myIO) -library(DT) -library(shiny) -library(shinydashboard) - -df <- read_html("https://raw.githubusercontent.com/sourcecred/research/master/sample-graphs/sourcecred_sourcecred.json") %>% - html_node('body') %>% - html_text() %>% - fromJSON() - -df_nodes <- map_df(df$nodes[[2]] , function(x) { - if(length(x) == 4){ - node_type <- gsub("_$", "", paste0(x[1:3], collapse = "_")) - final <- data.frame(node_type = node_type, stringsAsFactors = FALSE) - } else { - node_type <- gsub("_$", "", paste0(x[1:4], collapse = "_")) - final <- data.frame(node_type = node_type, stringsAsFactors = FALSE) - } - - return(final) -}) - -df_edges <- df$edges[[2]] %>% - bind_cols() %>% - group_by(row_number()) %>% - mutate(edge_type = gsub("_$", "", paste0(gsub("[0-9]", "", address[1][[1]][1:4]), collapse = "_")), - source_node = df_nodes$node_type[ srcIndex + 1 ], - dest_node = df_nodes$node_type[ dstIndex + 1 ]) %>% - ungroup()%>% - select(edge_type, srcIndex, dstIndex, source_node, dest_node) - -## count node types -node_types_count <- df_nodes %>% - group_by(node_type) %>% - summarise(Counts = as.numeric(n())) %>% - arrange(Counts) - -node_types_graph <- myIO::myIO(width = "100%") %>% - myIO::addIoLayer(type = "bar", - color = "steelblue", - label = "Count", - data = node_types_count, - mapping = list( - x_var = 'node_type', - y_var = "Counts" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 250, top = 40)%>% - myIO::suppressLegend() - -## count edge types -edge_types_count <- df_edges %>% - group_by(edge_type) %>% - summarise(Counts = as.numeric(n())) %>% - arrange(Counts) - -edge_types_graph <- myIO::myIO(width = "100%") %>% - myIO::addIoLayer(type = "bar", - color = "orange", - label = "Count", - data = edge_types_count, - mapping = list( - x_var = 'edge_type', - y_var = "Counts" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 250, top = 40)%>% - myIO::suppressLegend() - -## count node pairings (by edge type?) -node_pairings_count <- df_edges %>% - group_by(edge_type, source_node, dest_node) %>% - summarise(Count = n()) %>% - arrange(desc(Count)) - -node_pairings_table <- DT::datatable(node_pairings_count) - -## text analysis of nodes -node_tokens <- df$nodes[[2]] %>% - lapply(., function(x){ - final = data.frame(text = paste0(x, collapse = ", "), stringsAsFactors = FALSE) - return(final) - }) %>% - bind_rows() %>% - unnest_tokens(word, text) %>% - filter(!grepl("[0-9]", word)) %>% - group_by(word) %>% - summarise(Count = n()) %>% - top_n(10, Count) %>% - arrange(Count) - -node_tokens_graph <- myIO::myIO(width = "100%") %>% - myIO::addIoLayer(type = "bar", - color = "#004D40", - label = "Count", - data = node_tokens, - mapping = list( - x_var = 'word', - y_var = "Count" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 100, top = 40)%>% - myIO::suppressLegend() - -## text analysis of edges -edge_tokens <- df$edges[[2]]$address %>% - lapply(., function(x){ - final = data.frame(text = paste0(x, collapse = ", "), stringsAsFactors = FALSE) - return(final) - }) %>% - bind_rows() %>% - unnest_tokens(word, text) %>% - filter(!grepl("[0-9]", word)) %>% - group_by(word) %>% - summarise(Count = n())%>% - top_n(20, Count) %>% - arrange(Count) - -edge_tokens_graph <- myIO::myIO(width = "100%") %>% - myIO::addIoLayer(type = "bar", - color = "#D81B60", - label = "Count", - data = edge_tokens, - mapping = list( - x_var = 'word', - y_var = "Count" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 150, top = 40)%>% - myIO::suppressLegend() - -``` - -## Introduction - -This document presents an exploratory data analysis of the Source Cred graph data located at GitHub. This analysis exists an RMarkdown file that can be rerun on demand given new data available. - -The data holds `r format(nrow(df_nodes), big.mark = ",")` nodes and `r format(nrow(df_edges), big.mark = ",")` edges. For the different node and edge types, there are `r format(nrow(node_pairings_count), big.mark = ",")` unique node pairings. - -## Node Types - -Nodes are stored as an array of strings following this basic pattern: - -```{r eval=FALSE, echo=TRUE} -{"sourcecred","git","COMMIT","007cf88172d7ea9b0cdada78f124f7a41b811b30"} -``` - -To determine the node types, the first 3-4 string objects in the node were concatenated. This yielded `r format(nrow(node_types_count), big.mark = ",")` unique node types summarized by counts in the graph below. - -```{r} -shiny::fluidRow(shiny::column(12, (shinydashboard::box(node_types_graph, width = "90%")))) -``` - -## Edge Types - -Edges are stored as a nested array with an address and two index numbers relating to the connected nodes. The address nests the data relating to the edge type. An example of an edge looks like (commit hashes have been truncated for reading ease): - -```{r eval=FALSE, echo=TRUE} -{ - "address": [ - "sourcecred", "git","HAS_PARENT", "2","COMMIT","007cf881...", "2","COMMIT","d310561b..." - ], - "dstIndex": 744, - "srcIndex": 0 -} -``` - -To determine the edge types, the first 3-4 string objects in the node were concatenated. This yielded `r format(nrow(edge_types_count), big.mark = ",")` unique edge types summarized by counts in the graph below. - -```{r} -shiny::fluidRow(shiny::column(12, (shinydashboard::box(edge_types_graph, width = "90%")))) -``` - -## Node Pairings - -To get a better sense of how nodes and egdes work together to form the network, we can look at the node pairings by edge type. Currently, there are `r format(nrow(node_pairings_count), big.mark = ",")` pairings summarized by counts in the table below. - -```{r} -node_pairings_table -``` - -## Node Word Tokens - -While the node types appear to clearly identify all the important information about nodes, a text based analysis was employed to confirm that node types are the predominant data stored in the nodes. The text analysis tokenized the words in the node data and generated word counts across all nodes. The top `r format(nrow(node_tokens), big.mark = ",")` words are are summarized in the chart below. - -```{r} -shiny::fluidRow(shiny::column(12, (shinydashboard::box(node_tokens_graph, width = "90%")))) -``` - -## Edge Word Tokens - -While the edge types appear to clearly identify all the important information about edges, a text based analysis was employed to confirm that edge types are the predominant data stored in the edges. In addition, user names begin to show up more dominantly in edges than in nodes. - -The text analysis tokenized the words in the edge data and generated word counts across all edges. The top `r format(nrow(edge_tokens), big.mark = ",")` words are are summarized in the chart below. - -```{r} -shiny::fluidRow(shiny::column(12, (shinydashboard::box(edge_tokens_graph, width = "90%")))) -``` - -## Recommendations - -Given the data available, the following recommendations are made for visualizing the data: - -- Node and Edge Types provide a stable view of the data that can easily translate to a data visualization - -- Edge data provides greater information regarding the who and what of the network graph - -- Adding node and edge scoring would improve the understanding of the network - -- Labelling would require a subset of data as the current data set is too large - -- Data visualizations should include at least the option for the following elements: - - 1. Node types by color - - 2. Edge types by color - - 3. Node scores/weights by radius size - - 4. Edge scores/weights by stroke width - - 5. Popover capabilities for displaying more in-depth information and labels - - 6. Data management support for unnamed and nested node/edge data \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/58B51A6F b/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/58B51A6F deleted file mode 100644 index f4cdad0..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/58B51A6F +++ /dev/null @@ -1,22 +0,0 @@ -{ - "collab_server" : "", - "contents" : "", - "created" : 1554229290615.000, - "dirty" : false, - "encoding" : "UTF-8", - "folds" : "", - "hash" : "1521928135", - "id" : "58B51A6F", - "lastKnownWriteTime" : 1554837218, - "last_content_update" : 1554837218461, - "path" : "~/GitHub/research/exploratory/rMorton/dev_eda.R", - "project_path" : "dev_eda.R", - "properties" : { - "cursorPosition" : "17,0", - "scrollLine" : "0" - }, - "relative_order" : 1, - "source_on_save" : false, - "source_window" : "", - "type" : "r_source" -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/58B51A6F-contents b/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/58B51A6F-contents deleted file mode 100644 index 5ce0278..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/per/t/58B51A6F-contents +++ /dev/null @@ -1,161 +0,0 @@ -library(jsonlite) -library(rvest) -library(xml2) -library(tidyr) -library(dplyr) -library(purrr) -library(tidytext) -library(myIO) -library(DT) - -df <- read_html("https://raw.githubusercontent.com/sourcecred/research/master/sample-graphs/sourcecred_sourcecred.json") %>% - html_node('body') %>% - html_text() %>% - fromJSON() - -gsub("]", "}", gsub("\\[", "{", toJSON(df$nodes[[2]][[1]]))) - -{ - "address": [ - "sourcecred", "git","HAS_PARENT", "2","COMMIT","007cf88172d7ea9b0cdada78f124f7a41b811b30", "2","COMMIT","d310561b9473ecaa0e22da3dac089ab61df2f723"], - "dstIndex": 744, - "srcIndex": 0 -} - - -df_nodes <- map_df(df$nodes[[2]] , function(x) { - if(length(x) == 4){ - node_type <- gsub("_$", "", paste0(x[1:3], collapse = "_")) - final <- data.frame(node_type = node_type, stringsAsFactors = FALSE) - } else { - node_type <- gsub("_$", "", paste0(x[1:4], collapse = "_")) - final <- data.frame(node_type = node_type, stringsAsFactors = FALSE) - } - - return(final) -}) - -df_edges <- df$edges[[2]] %>% - bind_cols() %>% - group_by(row_number()) %>% - mutate(edge_type = gsub("_$", "", paste0(gsub("[0-9]", "", address[1][[1]][1:4]), collapse = "_")), - source_node = df_nodes$node_type[ srcIndex + 1 ], - dest_node = df_nodes$node_type[ dstIndex + 1 ]) %>% - ungroup()%>% - select(edge_type, srcIndex, dstIndex, source_node, dest_node) - -## count node types -node_types_count <- df_nodes %>% - group_by(node_type) %>% - summarise(Counts = as.numeric(n())) %>% - arrange(Counts) - -node_types_graph <- myIO::myIO() %>% - myIO::addIoLayer(type = "bar", - color = "steelblue", - label = "Count", - data = node_types_count, - mapping = list( - x_var = 'node_type', - y_var = "Counts" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 250, top = 40)%>% - myIO::suppressLegend() - -## count edge types -edge_types_count <- df_edges %>% - group_by(edge_type) %>% - summarise(Counts = as.numeric(n())) %>% - arrange(Counts) - -edge_types_graph <- myIO::myIO() %>% - myIO::addIoLayer(type = "bar", - color = "orange", - label = "Count", - data = edge_types_count, - mapping = list( - x_var = 'edge_type', - y_var = "Counts" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 250, top = 40)%>% - myIO::suppressLegend() - -## count node pairings (by edge type?) -node_pairings_count <- df_edges %>% - group_by(edge_type, source_node, dest_node) %>% - summarise(Count = n()) %>% - arrange(desc(Count)) - -node_pairings_table <- DT::datatable(node_pairings_count) - -## text analysis of nodes -node_tokens <- df$nodes[[2]] %>% - lapply(., function(x){ - final = data.frame(text = paste0(x, collapse = ", "), stringsAsFactors = FALSE) - return(final) - }) %>% - bind_rows() %>% - unnest_tokens(word, text) %>% - filter(!grepl("[0-9]", word)) %>% - group_by(word) %>% - summarise(Count = n()) %>% - top_n(10, Count) %>% - arrange(Count) - -node_tokens_graph <- myIO::myIO() %>% - myIO::addIoLayer(type = "bar", - color = "#004D40", - label = "Count", - data = node_tokens, - mapping = list( - x_var = 'word', - y_var = "Count" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 100, top = 40)%>% - myIO::suppressLegend() - -## tesxt analysis of edges -edge_tokens <- df$edges[[2]]$address %>% - lapply(., function(x){ - final = data.frame(text = paste0(x, collapse = ", "), stringsAsFactors = FALSE) - return(final) - }) %>% - bind_rows() %>% - unnest_tokens(word, text) %>% - filter(!grepl("[0-9]", word)) %>% - group_by(word) %>% - summarise(Count = n())%>% - top_n(20, Count) %>% - arrange(Count) - -edge_tokens_graph <- myIO::myIO() %>% - myIO::addIoLayer(type = "bar", - color = "#D81B60", - label = "Count", - data = edge_tokens, - mapping = list( - x_var = 'word', - y_var = "Count" - ), - options = list(barSize = "large"))%>% - myIO::setAxisLimits(ylim = list(min = "0")) %>% - myIO::setAxisFormat(xAxis = "text",yAxis = ",.0f", toolTip = ",.0f") %>% - myIO::flipAxis()%>% - myIO::defineCategoricalAxis()%>% - myIO::setmargin(left = 150, top = 40)%>% - myIO::suppressLegend() diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/2F511253 b/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/2F511253 deleted file mode 100644 index 690ae07..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/2F511253 +++ /dev/null @@ -1,5 +0,0 @@ -{ - "cursorPosition" : "236,98", - "scrollLine" : "235", - "tempName" : "Untitled1" -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/FDC782 b/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/FDC782 deleted file mode 100644 index 9281a55..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/FDC782 +++ /dev/null @@ -1,4 +0,0 @@ -{ - "cursorPosition" : "17,0", - "scrollLine" : "0" -} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/INDEX b/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/INDEX deleted file mode 100644 index f0a1a75..0000000 --- a/exploratory/rMorton/.Rproj.user/C5F3700/sources/prop/INDEX +++ /dev/null @@ -1,2 +0,0 @@ -~%2FGitHub%2Fresearch%2Fexploratory%2FrMorton%2Fdev_eda.R="FDC782" -~%2FGitHub%2Fresearch%2Fexploratory%2FrMorton%2Fsc_eda_doc.Rmd="2F511253" diff --git a/exploratory/rMorton/.Rproj.user/shared/notebooks/3709FB68-sc_eda_doc/1/C5F3700E8AD6166/chunks.json b/exploratory/rMorton/.Rproj.user/shared/notebooks/3709FB68-sc_eda_doc/1/C5F3700E8AD6166/chunks.json deleted file mode 100644 index 1cd9594..0000000 --- a/exploratory/rMorton/.Rproj.user/shared/notebooks/3709FB68-sc_eda_doc/1/C5F3700E8AD6166/chunks.json +++ /dev/null @@ -1 +0,0 @@ -{"chunk_definitions":[],"doc_write_time":1554834249} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/shared/notebooks/3709FB68-sc_eda_doc/1/s/chunks.json b/exploratory/rMorton/.Rproj.user/shared/notebooks/3709FB68-sc_eda_doc/1/s/chunks.json deleted file mode 100644 index 1cd9594..0000000 --- a/exploratory/rMorton/.Rproj.user/shared/notebooks/3709FB68-sc_eda_doc/1/s/chunks.json +++ /dev/null @@ -1 +0,0 @@ -{"chunk_definitions":[],"doc_write_time":1554834249} \ No newline at end of file diff --git a/exploratory/rMorton/.Rproj.user/shared/notebooks/patch-chunk-names b/exploratory/rMorton/.Rproj.user/shared/notebooks/patch-chunk-names deleted file mode 100644 index e69de29..0000000 diff --git a/exploratory/rMorton/.Rproj.user/shared/notebooks/paths b/exploratory/rMorton/.Rproj.user/shared/notebooks/paths deleted file mode 100644 index c14c9b3..0000000 --- a/exploratory/rMorton/.Rproj.user/shared/notebooks/paths +++ /dev/null @@ -1 +0,0 @@ -C:/Users/Morton/Documents/GitHub/research/exploratory/rMorton/sc_eda_doc.Rmd="3709FB68" diff --git a/exploratory/rMorton/d3-graphNet/.gitignore b/exploratory/rMorton/d3-graphNet/.gitignore deleted file mode 100644 index e790593..0000000 --- a/exploratory/rMorton/d3-graphNet/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -build/ -node_modules -npm-debug.log diff --git a/exploratory/rMorton/d3-graphNet/.npmignore b/exploratory/rMorton/d3-graphNet/.npmignore deleted file mode 100644 index 6e6b220..0000000 --- a/exploratory/rMorton/d3-graphNet/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -build/*.zip -test/ diff --git a/exploratory/rMorton/d3-graphNet/LICENSE b/exploratory/rMorton/d3-graphNet/LICENSE deleted file mode 100644 index a69a5cb..0000000 --- a/exploratory/rMorton/d3-graphNet/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -SourceCred is dual-licensed under the MIT License and the Apache-2 -License. See LICENSE-MIT and LICENSE-APACHE for the terms of these -licenses. diff --git a/exploratory/rMorton/d3-graphNet/README.md b/exploratory/rMorton/d3-graphNet/README.md deleted file mode 100644 index 45684e2..0000000 --- a/exploratory/rMorton/d3-graphNet/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# d3-graphNet - -Source Cred Network Graph - -## Installing - -If you use NPM, `npm install d3-graphNet`. Otherwise, download the [latest release](https://github.com/sourcecred/research/tree/rm-exploratory/exploratory/rMorton/d3-graphNet). - -## API Reference - -TODO diff --git a/exploratory/rMorton/d3-graphNet/index.js b/exploratory/rMorton/d3-graphNet/index.js deleted file mode 100644 index af39ff7..0000000 --- a/exploratory/rMorton/d3-graphNet/index.js +++ /dev/null @@ -1 +0,0 @@ -export {default as d3-graphNet} from "./src/d3-graphNet"; diff --git a/exploratory/rMorton/d3-graphNet/package.json b/exploratory/rMorton/d3-graphNet/package.json deleted file mode 100644 index 8a0b0b2..0000000 --- a/exploratory/rMorton/d3-graphNet/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "d3-graphNet", - "version": "0.0.1", - "description": "Network graph for Source Cred", - "keywords": [ - "d3", - "d3-module", - "d3-graphNet", - "SourceCred" - ], - "license": "MIT", - "main": "build/d3-graphNet.js", - "jsnext:main": "index", - "homepage": "https://github.com/{USERNAME}/d3-foo", - "repository": { - "type": "git", - "url": "https://github.com/{USERNAME}/d3-foo.git" - }, - "scripts": { - "pretest": "rm -rf build && mkdir build && rollup -f umd -n d3 -o build/d3-foo.js -- index.js", - "test": "tape 'test/**/*-test.js'", - "prepublish": "npm run test && uglifyjs build/d3-foo.js -c -m -o build/d3-foo.min.js", - "postpublish": "zip -j build/d3-foo.zip -- LICENSE README.md build/d3-foo.js build/d3-foo.min.js" - }, - "devDependencies": { - "rollup": "0.27", - "tape": "4", - "uglify-js": "2" - } -} diff --git a/exploratory/rMorton/d3-graphNet/src/d3-graphNet.js b/exploratory/rMorton/d3-graphNet/src/d3-graphNet.js deleted file mode 100644 index 84f6727..0000000 --- a/exploratory/rMorton/d3-graphNet/src/d3-graphNet.js +++ /dev/null @@ -1,230 +0,0 @@ -// network graph - Source Cred open source project -// Ryan Morton April 2019 - -class graphNet { - - constructor(opts) { - //example opts object - /* - const opts = { - element: document.getElementById("sourceCred"), - data: myData, - score: myScores, - mapping: { - nodes: 'nodes', - nodeLable: 1, - nodeGroup: null, - nodeSize: null, - edges: 'edges', - edgeGroup: null, - edgeSize: null, - source: null, - target: null - }, - options: null - } - */ - - // load arguments from config object - this.element = opts.element; - this.data = opts.data; - this.scores = opts.scores; - this.mapping = opts.mapping; - this.options = opts.options; - - // create the chart - this.draw(); - } - - draw(){ - //preserve context for closures - var that = this; - - // define dimensions - this.width = this.element.offsetWidth; - this.height = 1000; //this.element.offsetHeight; - - // set up parent element and SVG - this.element.innerHTML = ''; - this.svg = d3.select(this.element).append('svg'); - this.svg.attr('width', this.width); - this.svg.attr('height', this.height); - this.chart = this.svg - .append("g") - .attr("transform", "translate(" + this.width / 2 + "," + this.height / 2 + ")") - - // set up svg defs - this.chart.append("defs").append("marker") - .attr("id", "arrow") - .attr("viewBox", "0 -3 10 10") - .attr("refX", 18) - .attr("refY", 0) - .attr("markerWidth", 5) - .attr("markerHeight", 5) - .attr("orient", "auto") - .append("svg:path") - .attr("d", "M 0,-5 L 10 ,0 L 0,5"); - - //chart elements - this.edge = this.chart.append("g"); - this.node = this.chart.append("g"); - this.tooltip = d3.select(this.element).append("div") - .attr("class", "toolTip") - .style('display', 'none') - .style('position', 'absolute') - .style('min-width' , '50px') - .style('height', 'auto') - .style('background', 'none repeat scroll 0 0 #ffffff') - - //initialize simulation - ///define variables from data for simulation only - ///data updates chart and restarts simulation later - const links = this.data[this.mapping.edges]; - if(that.mapping.source){ - links.forEach(function(d){ - d.source = d[that.mapping.source]; - d.target = d[that.mapping.target]; - }); - } - - const nodes = this.data[this.mapping.nodes]; - - /// define simulation object - this.simulation = d3.forceSimulation(nodes) - .force("charge", d3.forceManyBody().strength(-1)) - .force("link", d3.forceLink(links).distance(100)) - .force("collide", d3.forceCollide().radius(2)) - .force("x", d3.forceX()) - .force("y", d3.forceY()) - .alphaTarget(1) - .on("tick", ticked); - - function ticked() { - that.node.selectAll('.node').attr("cx", function(d) { return d.x; }) - .attr("cy", function(d) { return d.y; }) - - //TODO: fix arrow marker by moving back based on the node radius - that.edge.selectAll('.edge').attr("x1", function(d) { return d.source.x; }) - .attr("y1", function(d) { return d.source.y; }) - .attr("x2", function(d) { return d.target.x; }) - .attr("y2", function(d) { return d.target.y; }); - } - - //this.setColorScales(); - this.nodeColor = d3.scaleOrdinal(d3.schemeCategory10); - this.edgeColor = d3.scaleOrdinal(d3.schemeCategory10); - // update chart - // this.addZoom(); - this.update(this.data); - } - - update(data) { - - //preserve context for functions - const that = this; - - //define variables from data - const links = data[this.mapping.edges]; - if(that.mapping.source){ - links.forEach(function(d){ - d.source = d[that.mapping.source]; - d.target = d[that.mapping.target]; - }); - } - - const nodes = data[this.mapping.nodes]; - - // restart simulation with new data - // node data join - // TODO: add drag behavior - var node = that.node.selectAll(".node").data(nodes); - - // node exit - node.exit() - .transition() - .ease(d3.easeQuad) - .duration(1000) - .remove(); - - //node enter - var newNode = node.enter() - .append('circle') - .attr('class', 'node') - .on('mouseover', mouseOver) - .on('mouseout', mouseOff); - - // node update - node.merge(newNode) - .transition() - .ease(d3.easeQuad) - .duration(1000) - .attr('fill', function(d){ - if(that.mapping.nodeGroup){ - return that.nodeColor(d[that.mapping.nodeGroup]); - } else { - return 'steelblue'; - } - }) - .attr('r', function(d){ - if(that.mapping.nodeSize){ - return Math.min(75,Math.max(1, that.scores[d.index] * 1000)); - } else { - return 5; - } - }); - - // edge data join - var edge = that.edge.selectAll('.edge').data(links); - - // edge exit - edge.exit().remove(); - - // edge enter - var newEdge = edge.enter() - .append('line') - .attr('class', 'edge'); - - edge.merge(newEdge) - .transition() - .ease(d3.easeQuad) - .duration(1000) - .attr("marker-end", "url(#arrow)") - .attr('stroke-width', function(d){ - if(that.mapping.edgeSize){ - return d[that.mapping.edgeSize]; - } else { - return 0.25; - } - }) - .attr('stroke', function(d){ - if(that.mapping.edgeGroup){ - return that.edgeColor(d[that.mapping.edgeGroup]); - } else { - return '#000'; - } - }); - - // Update and restart the simulation. - that.simulation.nodes(nodes); - that.simulation.force("link").links(links); - that.simulation.alpha(1).restart(); - - function mouseOver(){ - var data = d3.select(this).data()[0]; - var textDisplay = data[that.mapping.nodeLabel] + '-' + that.scores[data.index].toFixed(3); - - that.tooltip - .style("left", (d3.event.pageX - 10) + 'px') - .style("top", (d3.event.pageY - 30) + 'px') - .style("display", "inline-block") - .html(function(){ - return textDisplay; - }); - } - - function mouseOff(){ - that.tooltip.style("display", "none"); - } - - } -} \ No newline at end of file diff --git a/exploratory/rMorton/d3-graphNet/test/foo-test.js b/exploratory/rMorton/d3-graphNet/test/foo-test.js deleted file mode 100644 index c7ff70b..0000000 --- a/exploratory/rMorton/d3-graphNet/test/foo-test.js +++ /dev/null @@ -1,7 +0,0 @@ -var tape = require("tape"), - foo = require("../"); - -tape("foo() returns the answer to the ultimate question of life, the universe, and everything.", function(test) { - test.equal(foo.foo(), 42); - test.end(); -}); diff --git a/infra/pySourceCredChart/js/lib/pySourceCredChart.js b/infra/pySourceCredChart/js/lib/pySourceCredChart.js index 7032af4..7492d32 100644 --- a/infra/pySourceCredChart/js/lib/pySourceCredChart.js +++ b/infra/pySourceCredChart/js/lib/pySourceCredChart.js @@ -1,7 +1,11 @@ var widgets = require('@jupyter-widgets/base'); +require('../style/pySourceCredChart.css'); import * as d3 from 'd3'; +/// set constants +const MAX_SIZE_PIXELS = 200 + var sourceCredChartModel = widgets.DOMWidgetModel.extend({ defaults:_.extend(_.result(this, 'widgets.DOMWidgetModel.prototype.defaults'),{ _model_name: 'sourceCredChartModel', @@ -12,12 +16,15 @@ var sourceCredChartModel = widgets.DOMWidgetModel.extend({ }); var sourceCredChartView = widgets.DOMWidgetView.extend({ + render: function(){ - var that = this; - /// set up chart space without data + const that = this; + this.chartContainer = d3.select(this.el); - var message = new Promise(function(resolve, reject){ + setScaffolding(that); + + const message = new Promise(function(resolve, reject){ resolve(that.model.get('_model_msg')) }); @@ -28,7 +35,6 @@ var sourceCredChartView = widgets.DOMWidgetView.extend({ }); this.model.on('change:_model_msg', this.message_changed, this); - this.model.on('change:_model_data', this.data_changed, this); }, message_changed: function(){ @@ -36,37 +42,113 @@ var sourceCredChartView = widgets.DOMWidgetView.extend({ this.draw(this.el.msg[0]); }, - data_changed: function(){ - this.el.data = this.model.get('_model_data'); - this.update(this.el.data); - }, draw: function(opts){ - console.log(opts); + const that = this; + + this.data = opts.data; this.scores = opts.scores; this.mapping = opts.mapping; this.options = opts.options; - console.log(this.data); - console.log(this.mapping); - //preserve context for closures - var that = this; + this.links = this.data[this.mapping.edges]; + if(that.mapping.source){ + this.links.forEach(function(d){ + d.source = d[that.mapping.source]; + d.target = d[that.mapping.target]; + }); + } + + this.nodes = this.data[this.mapping.nodes]; + + this.simulation = _simulation(that, this.nodes, this.links); + + updateNodes(that, this.nodes); + updateEdges(that, this.links); + + that.simulation.nodes(this.nodes); + that.simulation.force("link").links(this.links); + that.simulation.alpha(1).restart(); + } + +}); + + /// d3 based calculations; should work for both this library and React+d3 UI + function _radius(that, d){ + if(that.scores){ + // Use the square of the score as radius, so area will be proportional to score (if score available). + // For the Python implementation, the scores are separate from the node so we use the node index to + // find the score. + const _maxScore = d3.max(that.scores); + const score = that.scores[d.index]; + const r = Math.sqrt((score / _maxScore) * MAX_SIZE_PIXELS) + 3; + + if (!isFinite(r)) { + return 0; + } + return r; + } else { + return 5 + } - // define dimensions - this.width = 800; - this.height = 600; + } + + function _simulation(that, nodes, links){ - // set up parent element and SVG - this.chartContainer.innerHTML = ''; - this.svg = this.chartContainer.append('svg'); - this.svg.attr('width', this.width); - this.svg.attr('height', this.height); - this.chart = this.svg + const linkForce = d3.forceLink(links) + //.id((d) => d.address) + .distance(120); + + const nodeCharge = d3.forceManyBody().strength(-380); + + const nodeCollide = d3.forceCollide().radius((d) => { + _radius(that,d); + }); + + const simulation = d3.forceSimulation(nodes) + .force("charge", nodeCharge) + .force("link", linkForce) + .force("collide", nodeCollide) + .force("x", d3.forceX()) + .force("y", d3.forceY()) + .alphaTarget(0.02) + .alphaMin(0.01) + .on("tick", ticked); + + function ticked(){ + that.node + .selectAll('.node') + .attr("cx", (d) => d.x ) + .attr("cy", (d) => d.y ) + + //TODO: fix arrow marker by moving back based on the node radius + that.edge + .selectAll('.edge') + .attr("x1", (d) => d.source.x ) + .attr("y1", (d) => d.source.y ) + .attr("x2", (d) => d.target.x ) + .attr("y2", (d) => d.target.y ); + } + + return simulation + } + + /// d3 based DOM functions; trying to mimic React Components + function setScaffolding(that){ + + //TODO: find a better way to assert width/height in Jupyter Notebook + that.width = 800; + that.height = 600; + + that.chartContainer.innerHTML = ''; + that.svg = that.chartContainer.append('svg'); + that.svg.attr('width', that.width); + that.svg.attr('height', that.height); + that.chart = that.svg .append("g") - .attr("transform", "translate(" + this.width / 2 + "," + this.height / 2 + ")") + .attr("transform", "translate(" + that.width / 2 + "," + that.height / 2 + ")") - // set up svg defs - this.chart.append("defs").append("marker") + that.chart.append("defs").append("marker") .attr("id", "arrow") .attr("viewBox", "0 -3 10 10") .attr("refX", 18) @@ -77,134 +159,84 @@ var sourceCredChartView = widgets.DOMWidgetView.extend({ .append("svg:path") .attr("d", "M 0,-5 L 10 ,0 L 0,5"); - //chart elements - this.edge = this.chart.append("g"); - this.node = this.chart.append("g"); - this.tooltip = d3.select(this.element).append("div") + that.edge = that.chart.append("g"); + that.node = that.chart.append("g"); + + that.tooltip = that.chartContainer.append("div") .attr("class", "toolTip") .style('display', 'none') .style('position', 'absolute') .style('min-width' , '50px') .style('height', 'auto') - .style('background', 'none repeat scroll 0 0 #ffffff') + .style('background', 'none repeat scroll 0 0 #ffffff'); + } - //initialize simulation - ///define variables from data for simulation only - ///data updates chart and restarts simulation later - const links = this.data[this.mapping.edges]; - if(that.mapping.source){ - links.forEach(function(d){ - d.source = d[that.mapping.source]; - d.target = d[that.mapping.target]; - }); - } - console.log(links); - - const nodes = this.data[this.mapping.nodes]; - console.log(nodes); + function updateNodes(that, nodes){ - /// define simulation object - this.simulation = d3.forceSimulation(nodes) - .force("charge", d3.forceManyBody().strength(-1)) - .force("link", d3.forceLink(links).distance(100)) - .force("collide", d3.forceCollide().radius(2)) - .force("x", d3.forceX()) - .force("y", d3.forceY()) - .alphaTarget(1) - .on("tick", ticked); - - function ticked() { - that.node.selectAll('.node').attr("cx", function(d) { return d.x; }) - .attr("cy", function(d) { return d.y; }) - - //TODO: fix arrow marker by moving back based on the node radius - that.edge.selectAll('.edge').attr("x1", function(d) { return d.source.x; }) - .attr("y1", function(d) { return d.source.y; }) - .attr("x2", function(d) { return d.target.x; }) - .attr("y2", function(d) { return d.target.y; }); - } - - //this.setColorScales(); - this.nodeColor = d3.scaleOrdinal(d3.schemeCategory10); - this.edgeColor = d3.scaleOrdinal(d3.schemeCategory10); - // update chart - // this.addZoom(); - this.update(this.data); - - function timeIt(){ - setTimeout(function(){ - console.log("call stop"); - that.simulation.alpha(0).restart(); - that.simulation.stop(); - }, 20000); - } - timeIt(); - }, - update: function(newData){ - console.log(newData); - //preserve context for functions - const that = this; - - var data = newData.length == 1 ? newData[0] : newData; - - //define variables from data - const links = data[this.mapping.edges]; - if(that.mapping.source){ - links.forEach(function(d){ - d.source = d[that.mapping.source]; - d.target = d[that.mapping.target]; - }); - } - - const nodes = data[this.mapping.nodes]; - - // restart simulation with new data - // node data join - // TODO: add drag behavior - var node = that.node.selectAll(".node").data(nodes); - - // node exit + const nodeColor = d3.scaleOrdinal(d3.schemeCategory10); + const node = that.node.selectAll(".node").data(nodes); + node.exit() .transition() .ease(d3.easeQuad) .duration(1000) .remove(); - - //node enter - var newNode = node.enter() + + const newNode = node.enter() .append('circle') .attr('class', 'node') .on('mouseover', mouseOver) - .on('mouseout', mouseOff); + .on('mouseout', mouseOff) + .on('click', clickHalo); - // node update node.merge(newNode) .transition() .ease(d3.easeQuad) .duration(1000) - .attr('fill', function(d){ - if(that.mapping.nodeGroup){ - return that.nodeColor(d[that.mapping.nodeGroup]); - } else { - return 'steelblue'; - } - }) - .attr('r', function(d){ - if(that.mapping.nodeSize){ - return Math.min(75,Math.max(1, that.scores[d.index] * 1000)); - } else { - return 5; - } - }); + .attr('fill', (d) => that.mapping.nodeGroup ? nodeColor(d[that.mapping.nodeGroup]) : 'steelblue') + .attr('r', (d) => _radius(that, d)); + + function mouseOver(){ + const data = d3.select(this).data()[0]; + const textDisplay = data['index'] + '
' + data[that.mapping.nodeLabel] + '
' + data[3] + '
' + data[4] ; + const nodeColor = d3.select(this).style('fill'); + + that.tooltip + .style("left", (d3.event.pageX - 250) + 'px') + .style("top", 0 + 'px') + .style("display", "inline") + .style("background", nodeColor) + .html(() => textDisplay ); + } + + function mouseOff(){ + that.tooltip.style("display", "none"); + } + + function clickHalo(){ + + that.svg.selectAll('circle').attr('class', 'node'); + that.svg.selectAll('line').attr('class', 'edge'); + + const nodeIdx = d3.select(this).data()[0].index; + console.log(nodeIdx); + + d3.select(this).attr('class', 'halo'); - // edge data join - var edge = that.edge.selectAll('.edge').data(links); + const links = that.svg.selectAll(".edge").filter((d) => (d.dstIndex == nodeIdx | d.srcIndex == nodeIdx)); + links.attr('class', 'halo'); + } + } + + function updateEdges(that, links){ + + const edgeColor = d3.scaleOrdinal(d3.schemeCategory10); + + const edge = that.edge.selectAll('.edge').data(links); - // edge exit edge.exit().remove(); - // edge enter - var newEdge = edge.enter() + const newEdge = edge.enter() .append('line') .attr('class', 'edge'); @@ -213,46 +245,10 @@ var sourceCredChartView = widgets.DOMWidgetView.extend({ .ease(d3.easeQuad) .duration(1000) .attr("marker-end", "url(#arrow)") - .attr('stroke-width', function(d){ - if(that.mapping.edgeSize){ - return d[that.mapping.edgeSize]; - } else { - return 0.25; - } - }) - .attr('stroke', function(d){ - if(that.mapping.edgeGroup){ - return that.edgeColor(d[that.mapping.edgeGroup]); - } else { - return '#000'; - } - }); - - // Update and restart the simulation. - that.simulation.nodes(nodes); - that.simulation.force("link").links(links); - that.simulation.alpha(1).restart(); - - function mouseOver(){ - var data = d3.select(this).data()[0]; - var textDisplay = data[that.mapping.nodeLabel] + '-' + that.scores[data.index].toFixed(3); - - that.tooltip - .style("left", (d3.event.pageX - 10) + 'px') - .style("top", (d3.event.pageY - 30) + 'px') - .style("display", "inline-block") - .html(function(){ - return textDisplay; - }); - } - - function mouseOff(){ - that.tooltip.style("display", "none"); - } + .attr('stroke-width', (d) => that.mapping.edgeSize ? d[that.mapping.edgeSize] : 0.25) + .attr('stroke', (d) => that.mapping.edgeGroup ? edgeColor(d[that.mapping.edgeGroup]) : '#000' ); } -}); - module.exports = { sourceCredChartModel: sourceCredChartModel, sourceCredChartView: sourceCredChartView diff --git a/infra/pySourceCredChart/js/style/pySourceCredChart.css b/infra/pySourceCredChart/js/style/pySourceCredChart.css new file mode 100644 index 0000000..b95afd4 --- /dev/null +++ b/infra/pySourceCredChart/js/style/pySourceCredChart.css @@ -0,0 +1,23 @@ +circle.halo{ + fill: #00FF00; + stroke: #00FF00; + stroke-width: "3"; +} +line.halo{ + fill: #00FF00; + stroke: #00FF00; + stroke-width: "3"; +} + +.toolTip{ + border: "2px solid"; + borderRadius: "6px"; + maxWidth: "300px"; + color: white; + fill: white; + } + +text.toolTip{ + color: white; + fill: white; +} \ No newline at end of file diff --git a/infra/pySourceCredChart/notebook_examples/basic_usage.ipynb b/infra/pySourceCredChart/notebook_examples/basic_usage.ipynb index 4edaa36..5467519 100644 --- a/infra/pySourceCredChart/notebook_examples/basic_usage.ipynb +++ b/infra/pySourceCredChart/notebook_examples/basic_usage.ipynb @@ -28,7 +28,7 @@ " \n", "message = ([{\n", " 'element': \"myChart\",\n", - " 'data': data[1],\n", + " 'data': data2[1],\n", " 'scores': None,\n", " 'mapping': {\n", " 'nodes': 'nodes',\n", @@ -54,7 +54,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "2bd2d0a90658462e9eb76fff9a4be6e8", + "model_id": "b50c89af277e42c9863df06c29c52847", "version_major": 2, "version_minor": 0 }, @@ -73,16 +73,6 @@ "chart" ] }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [], - "source": [ - "new_data = data2[1]\n", - "chart.set_data([new_data])" - ] - }, { "cell_type": "code", "execution_count": null,