Exemplo n.º 1
0
        /// <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);

            HorizontalBarChartData data = new HorizontalBarChartData();

            data.Data   = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCSV(filePath));
            data.Domain = domain;

            DA.SetData(0, data);
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Pie Chart Data
        /// </summary>
        /// <param name="FilePath">File Path to CSV file.</param>
        /// <returns name="Data">Pie Chart Data object.</returns>
        public static PieChartData 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;
            }

            PieChartData data = new PieChartData();

            data.Data = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCSV(_filePath));

            return(data);
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Horizontal Bar Chart Data.
        /// </summary>
        /// <param name="FilePath"></param>
        /// <param name="Domain"></param>
        /// <returns name="Data">Data</returns>
        public static HorizontalBarChartData 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;
            }

            HorizontalBarChartData barData = new HorizontalBarChartData();

            barData.Data   = new JavaScriptSerializer().Serialize(ChartsUtilities.Data1FromCSV(_filePath));
            barData.Domain = Domain;
            return(barData);
        }