Skip to content

Commit

Permalink
Merge pull request #21 from ahoirg/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ahoirg authored Jun 4, 2023
2 parents 62e52e6 + a9644a1 commit dc208d2
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Assets/_UDVT/Scripts/Runtime/Helper/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using UnityEngine.SceneManagement;
using System.Linq;

/// <summary>
/// It contains the common methods used in the project.
/// </summary>
public class Helper : MonoBehaviour
{
public static bool FileValidation()
Expand Down
2 changes: 1 addition & 1 deletion Assets/_UDVT/Scripts/Runtime/MainScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;

/// <summary>
/// MainScript handles the activities needed at the start of the application.
/// It contains the scene where the graph will be plotted.
/// </summary>
public class MainScript : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
using UnityEngine;
using UnityEngine.SceneManagement;

/// <summary>
/// It contains formulas used in calculating the binning.
/// </summary>
public class ChooseBinningFormula : MonoBehaviour
{
public void StartWithSquareroot()
Expand Down
4 changes: 4 additions & 0 deletions Assets/_UDVT/Scripts/Runtime/MenuScripts/CurrentParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
using UnityEngine;
using UnityEngine.SceneManagement;

/// <summary>
/// It contains the variables defined to move the parameters
/// taken with the help of the menu between scenes.
/// </summary>
public class CurrentParams : MonoBehaviour
{
public static VisType currentVisType = VisType.Scatterplot; // default
Expand Down
12 changes: 11 additions & 1 deletion Assets/_UDVT/Scripts/Runtime/MenuScripts/LoadData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;


/// <summary>
/// LoadData, the field to load the data required for drawing the selected graph.
/// </summary>
public class LoadData : MonoBehaviour
{
private FileLoadingManager fileLoadingManager;
Expand All @@ -21,6 +26,7 @@ private async void InnerLoad()
//## 01: Load Dataset

string filePath = fileLoadingManager.StartPicker();

// Application waits for the loading process to finish
FileType file = await fileLoadingManager.LoadDataset();

Expand All @@ -29,7 +35,8 @@ private async void InnerLoad()
//## 02: Process Dataset
CsvFileType csvFile = (CsvFileType)file;
CurrentParams.loadedData = csvFile.GetDataSet();


//We are checking whether the loaded data is suitable for the graph.
if (Helper.FileValidation())
CallMainScene();
else
Expand All @@ -38,6 +45,9 @@ private async void InnerLoad()

}

/// <summary>
/// It directs to the screen where the graphic will be drawn.
/// </summary>
private void CallMainScene()
{
SceneManager.LoadScene("MainScene");
Expand Down
10 changes: 10 additions & 0 deletions Assets/_UDVT/Scripts/Runtime/MenuScripts/Menu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
using UnityEngine;
using UnityEngine.SceneManagement;

/// <summary>
/// Menu handles the activities needed at the start of the application.
/// </summary>
public class Menu : MonoBehaviour
{
public void StartWithScatterplot()
Expand All @@ -11,6 +14,10 @@ public void StartWithScatterplot()
CallLoadData();
}

/// <summary>
/// Some charts need extra information. Therefore, before going to the LoadData screen,
/// it goes to an intermediate screen.
/// </summary>
public void StartWithHistogram()
{
CurrentParams.currentVisType = VisType.Histogram;
Expand All @@ -35,6 +42,9 @@ public void StartWithHorizonGraph()
CallLoadData();
}

/// <summary>
/// It directs to the LoadData to load the data needed to draw the selected graph.
/// </summary>
private void CallLoadData()
{
SceneManager.LoadScene("LoadData");
Expand Down
9 changes: 8 additions & 1 deletion Assets/_UDVT/Scripts/Runtime/Visualization/VisDensityplot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

using static KernelDensityEstimation;


/// <summary>
/// It contains the necessary methods and parameters for ploting Densityplot.
/// </summary>
public class VisDensityplot : Vis
{
public double[,] KDEresult = null;
Expand Down Expand Up @@ -62,7 +66,10 @@ public override void ChangeDataMarks()
dataSets[0][yName] = Enumerable.Range(0, KDEresult.GetLength(0)).Select(x => KDEresult[x, 1]).ToArray();
}


/// <summary>
/// It connects the dots with a line.
/// </summary>
/// <param name="datamarks"></param>
public void ConnectDataMarks(List<DataMark> datamarks)
{
//Debug.Log(dataSets[0].ElementAt(0).Value[0]);
Expand Down
9 changes: 9 additions & 0 deletions Assets/_UDVT/Scripts/Runtime/Visualization/VisHistogram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
using System.Collections.Generic;
using System;

/// <summary>
/// It contains the formulas needed to calculate binings.
/// </summary>
public enum BinningType
{
Squareroot,
Sturges
}

/// <summary>
/// It contains the necessary methods and parameters for ploting histograms.
/// </summary>
public class VisHistogram : Vis
{
private List<double> _xData = new List<double>();
Expand Down Expand Up @@ -92,6 +98,9 @@ public override void ChangeDataMarks()

#region private

/// <summary>
/// After calculating the bining, it updates the xyzTicks.
/// </summary>
private void UpdatexyzTicks()
{
int len = dataSets[0].ElementAt(0).Value.Length;
Expand Down
Binary file added Slides/Task1.pptx
Binary file not shown.

0 comments on commit dc208d2

Please sign in to comment.