/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { string filePath = null; if (!DA.GetData <string>(0, ref filePath)) { return; } PieChartData data = new PieChartData(); data.Data = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCsv(filePath)); DA.SetData(0, data); }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param> protected override void SolveInstance(IGH_DataAccess DA) { string filePath = null; D3jsLib.Domain domain = null; if (!DA.GetData <string>(0, ref filePath)) { return; } DA.GetData <D3jsLib.Domain>(1, ref domain); LineChartData data = new LineChartData(); data.Data = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCsv(filePath)); data.Domain = domain; DA.SetData(0, data); }
/// <summary> /// Donut Chart Data from CSV. /// </summary> /// <param name="FilePath">File Path to CSV file.</param> /// <returns name="Data">Donut Chart Data</returns> /// <search>csv, donut, chart, data</search> public static DonutChartData DataFromCSV(object FilePath) { // get full path to file as string // if File.FromPath is used it returns FileInfo class string _filePath = ""; try { _filePath = (string)FilePath; } catch { _filePath = ((FileInfo)FilePath).FullName; } DonutChartData data = new DonutChartData(); data.Data = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCsv(_filePath)); return(data); }
/// <summary> /// Bar Chart Data object. /// </summary> /// <param name="FilePath">CSV File Path.</param> /// <param name="Domain">Optional Domain for data set.</param> /// <returns name="Data">Bar Chart Data</returns> /// <search>bar, chart, data</search> public static BarData DataFromCSV( object FilePath, [DefaultArgumentAttribute("Charts.MiscNodes.GetNull()")] Domain Domain) { // get full path to file as string // if File.FromPath is used it returns FileInfo class string _filePath = ""; try { _filePath = (string)FilePath; } catch { _filePath = ((FileInfo)FilePath).FullName; } BarData barData = new BarData(); barData.Data = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCsv(_filePath)); barData.Domain = Domain; return(barData); }