Skip to content

Commit

Permalink
refactor: add description for flowchart
Browse files Browse the repository at this point in the history
  • Loading branch information
yld-weng committed Aug 10, 2021
1 parent c0b23b6 commit 54dee89
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Performing a test usually consists the following steps:

In part 4 we will be looking at common hypothesis test method and their application in linear models. You can download the R script file [here](./script.R).

We have also prepared a flow chart helps you to choose a statistical test for comparing two variables. Please click the button below to start.
We have also prepared a flowchart helps you to choose a statistical test for comparing two variables. Please click the button below to start.

<ReactFlowProvider>
<FlowChart />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { MdHelp } from "react-icons/md"


/***********************************
* Flow chart Data and settings
* Flowchart Data and settings
**********************************/
const nodeTypes = {
start: TriangleNodeComponent,
Expand All @@ -36,7 +36,7 @@ let groupedData = [...chartNodeData, ...chartEdgeData]


/**************************
* Return flow chart
* Return flowchart
* @returns
*************************/
const flowChart = () => {
Expand All @@ -55,7 +55,7 @@ const flowChart = () => {


/****************************************
* Utility functions for the flow chart
* Utility functions for the flowchart
***************************************/

const onLoad = useCallback(
Expand Down Expand Up @@ -277,7 +277,7 @@ const flowChart = () => {

return (
<div>
<button className="px-5 py-3 rounded-md bg-shefPurple text-white my-10" onClick={() => setDisplayChart(!displayChart)}>Click here to open the flow chart</button>
<button className="px-5 py-3 rounded-md bg-shefPurple text-white my-10" onClick={() => setDisplayChart(!displayChart)}>Click here to open the flowchart</button>
<div
className={`${displayChart ? 'block' : 'hidden'} w-full hideScrollBar min-h-100 fixed flex flex-wrap top-0 left-0`}
style={{zIndex: '100', height: '100vh', overflowY: 'scroll'}}
Expand Down Expand Up @@ -354,12 +354,12 @@ const flowChart = () => {
<div id="sidebar" className="w-full md:w-4/12 2xl:w-3/12 bg-white p-3 overflow-y-auto hideScrollBar" style={{height: '100vh'}}>
<div className="w-full flex flex-wrap pb-5 space-x-2 space-y-2 border-b-1 border-gray-100">
<button
title="Centre the flow chart"
title="Centre the flowchart"
className="mt-2 ml-2 px-2 py-1 rounded-md bg-pink-600 hover:bg-pink-500 text-white font-semibold"
onClick={() => reactflowInstance.fitView()}
>Fit view</button>
<button
title="Reset the flow chart"
title="Reset the flowchart"
className="px-2 py-1 rounded-md bg-pink-600 hover:bg-pink-500 text-white font-semibold"
onClick={() => {setElements(groupedData); setClickedNodes([]); reactflowInstance.fitView()}}
>Restart</button>
Expand All @@ -370,11 +370,18 @@ const flowChart = () => {
</div>
{/* Path tracking */}
<div className="mt-5">
<h1 className="font-bold text-xl text-black">
<h1 className="font-semibold text-xl text-black">
{
clickedNodes.length >= 2
? 'Your paths:'
: '< Please click on the first two shapes to start. Click on questions to see more options.'
: <span className="font-light text-lg">
&#10140; Please click the first two shapes to start. <br/><br/>
&#10140; Click on questions (diamond shape) to see more options. <br/><br/>
&#10140; This flowchart is draggable and zoomable. <br/><br/>
&#10140; The screen will follow the clicked shapes by default. You can use the button on the bottom left to turn this off.<br/><br/>
&#10140; FAQ on the bottom right.
</span>

}
</h1>
<div className="py-3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const textForHelp = [
{
question: 'Introduction',
answer: 'This flow chart is a simple tool that help you to choose what statistical test to use for two variables. This was prepared for the Statistical Modelling learning path at dataviz.shef.ac.uk.'
answer: 'This flowchart is a simple tool that help you to choose what statistical test to use for two variables. This was prepared for the Statistical Modelling learning path at dataviz.shef.ac.uk.'
},
{
question: 'How do I get started?',
Expand All @@ -21,6 +21,6 @@ export const textForHelp = [
},
{
question: 'License',
answer: 'This flow chart and its content are covered by a Creative Commons license CC BY-SA 4.0.'
answer: 'This flowchart and its content are covered by a Creative Commons license CC BY-SA 4.0.'
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* OR
* -> If children are visible, recursively find visible children (of children) by setting "deepLevel" to true.
* If "deepLevel" is true, it will skip hidden children.
* @param {array} data current flow chart data
* @param {array} data current flowchart data
* @param {object} element element that user clicked
* @param {boolean} deepLevel whether to get data more than one level deep
* @returns {array} array of element ids.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ author: [Yu Liang Weng]
title: Which statistical test to use for two variables?
thumbnail: thumbnail/thumbnail.png
description: >
An interative tool based on the flow chart made by Jean Russell to help you determine which statistical test to use for two variables. This tool is a part of the statistical modelling learning path.
An interative tool based on the flowchart made by Jean Russell to help you determine which statistical test to use for two variables. This tool is a part of the statistical modelling learning path.
date: "2021-08-04"
category: [Research & Innovation IT]
tag: [Statistics, Interative]
Expand All @@ -18,11 +18,11 @@ import Thumb from "./thumbnail/flowChartInside.png"
export const data = [
{
"title": "Source",
"content": `This flow chart was prepared by <a href="https://scholar.google.co.uk/citations?user=UesDIkYAAAAJ&hl=en">Jean Russell</a> for the <a href="https://dataviz.shef.ac.uk/docs/18/03/2021/LearningPath-Statistical-Modeling">statistical modelling learning path</a>.`
"content": `This flowchart was prepared by <a href="https://scholar.google.co.uk/citations?user=UesDIkYAAAAJ&hl=en">Jean Russell</a> for the <a href="https://dataviz.shef.ac.uk/docs/18/03/2021/LearningPath-Statistical-Modeling">statistical modelling learning path</a>.`
},
{
"title": "Detail",
"content": `This chart was created using React and <a href="https://reactflow.dev/">React Flow</a> with customised components. Unfortunately, you can not embed the flow chart at the moment.`
"content": `This chart was created using React and <a href="https://reactflow.dev/">React Flow</a> with customised components. Unfortunately, you can not embed the flowchart at the moment.`
},
{
"title": "Code",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const thumbnail = () => {
id="visualisation"
style={{background: `url(${flowChartImg})`, maxWidth: '550px', maxHeight: '550px', minHeight: '550px', backgroundSize: 'cover', backgroundPosition: 'center', position: 'relative', padding: '1.25rem'}}
>
<h1 className="mt-0 font-bold" style={{fontSize: '2.2rem', lineHeight: '1.2', color: 'white', textShadow: '0px 1px 10px #2f2f2f'}}>An interactive flow chart helps you choose a <span style={{background: 'linear-gradient(45deg, rgba(0, 171, 255, 0.64) 10%, rgba(56, 255, 0, 0.6) 100%)', padding: '0 .1rem', textShadow: 'none', fontWeight: '800'}}>statistical test</span> for two variables</h1>
<h1 className="mt-0 font-bold" style={{fontSize: '2.2rem', lineHeight: '1.2', color: 'white', textShadow: '0px 1px 10px #2f2f2f'}}>An interactive flowchart helps you choose a <span style={{background: 'linear-gradient(45deg, rgba(0, 171, 255, 0.64) 10%, rgba(56, 255, 0, 0.6) 100%)', padding: '0 .1rem', textShadow: 'none', fontWeight: '800'}}>statistical test</span> for two variables</h1>
<div className="absolute right-0 m-5 text-xs text-right" style={{bottom: '25%', color: '#686868'}}>
<p>ANOVA</p>
<p>T-Test</p>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged && npm run test"
}
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ exports[`Search component return search result without error 1`] = `
<span
class=""
>
An interative tool based on the flow chart made by Jean Russell to help you determine which statistical test to use for two variables. This tool is a part of ...
An interative tool based on the flowchart made by Jean Russell to help you determine which statistical test to use for two variables. This tool is a part of ...
</span>
</span>
</h1>
Expand Down

0 comments on commit 54dee89

Please sign in to comment.