Example #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string        title      = "";
            List <double> values     = new List <double>();
            List <string> names      = new List <string>();
            string        textFormat = "";
            List <Color>  colors     = new List <Color>();

            DA.GetData(0, ref title);
            DA.GetDataList(1, values);
            DA.GetDataList(2, names);
            DA.GetData(3, ref textFormat);
            DA.GetDataList(4, colors);

            BarChart chartObject = new BarChart();

            dialogImage = chartObject;
            PterodactylGrasshopperBitmapGoo GH_bmp = new PterodactylGrasshopperBitmapGoo();

            chartObject.BarChartData(true, title, values, names, textFormat, colors, GH_bmp.ReferenceTag);
            using (Bitmap b = chartObject.ExportBitmap())
            {
                GH_bmp.Value      = b.Clone(new Rectangle(0, 0, b.Width, b.Height), b.PixelFormat);
                GH_bmp.ReportPart = chartObject.Create();
                DA.SetData(0, GH_bmp);
            }
        }
Example #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            bool          showGraph  = false;
            string        title      = "";
            List <double> values     = new List <double>();
            List <string> names      = new List <string>();
            string        textFormat = "";
            List <Color>  colors     = new List <Color>();
            string        path       = "";

            DA.GetData(0, ref showGraph);
            DA.GetData(1, ref title);
            DA.GetDataList(2, values);
            DA.GetDataList(3, names);
            DA.GetData(4, ref textFormat);
            DA.GetDataList(5, colors);
            DA.GetData(6, ref path);

            BarChart chartObject = new BarChart();

            chartObject.BarChartData(showGraph, title, values, names, textFormat, colors, path);
            if (showGraph)
            {
                chartObject.ShowDialog();
            }

            chartObject.Export();
            string reportPart = chartObject.Create();

            DA.SetData(0, reportPart);
        }