コード例 #1
0
        public void InitWorkBook(String @path, String name, CSVObject Ops)
        {
            Double[,] Data = ParseWorkbook(@path);

            if (Data != null)
            {
                Options = (Ops == null) ? new CSVObject(name, path).LoadOptionFile() : Ops;
                Pages   = App.WorksheetPages;
                Page    = (Pages.Count <= 0) ? Pages[App.CreatePage((int)Origin.PAGETYPES.OPT_WORKSHEET, "Book", "W", 2)] : Pages["Book"];
                Layers  = Page.Layers;
                Wks     = (Origin.Worksheet)Layers.Add(name, 0, null, 0, null);
                for (int i = 0; i < Columns; i++)
                {
                    Wks.Columns.Add(Long_Names[i]);
                    Wks.Columns[i].LongName = Long_Names[i];
                    Wks.Columns[i].Units    = Units[i];
                    Wks.Columns[i].Comments = Comments[i];
                }
                Wks.Activate();
                if (Wks == null)
                {
                    return;
                }

                Wks.SetData(Data, -1);
            }
        }
コード例 #2
0
        public void GenerateGraphs()
        {
            if (App.Pages["Book"] == null)
            {
                return;
            }

            for (int i = 1; i < App.Pages["Book"].Layers.Count; i++)
            {
                if (App.GraphPages[App.Pages["Book"].Layers[i].Name] == null)
                {
                    Origin.GraphPage gp = (App.GraphPages["Graph"] != null) ? App.GraphPages["Graph"] : App.GraphPages.Add(AppDomain.CurrentDomain.BaseDirectory + @"Content\GraphTemplate.otpu");
                    if (gp != null)
                    {
                        Origin.Worksheet CurrentWorksheet = (Origin.Worksheet)App.Pages["Book"].Layers[i];
                        for (int j = 0; j < gp.Layers.Count; j++)
                        {
                            Origin.GraphLayer gl = (Origin.GraphLayer)gp.Layers[j];
                            if (gl != null)
                            {
                                Origin.DataRange dr = null;

                                switch (j)
                                {
                                case 0:
                                    dr = CurrentWorksheet.NewDataRange(-1, 0, CurrentWorksheet.Rows, 1);
                                    break;

                                case 1:
                                    dr = CurrentWorksheet.NewDataRange(-1, 2, CurrentWorksheet.Rows, 2);
                                    break;

                                case 2:
                                    dr = CurrentWorksheet.NewDataRange(-1, 4, CurrentWorksheet.Rows, 6);
                                    gl.Execute("draw -n min -c #009300 -w 0.5 -d 1 -l -h [" + Options.GetOption("p_exp_min") + "];");
                                    break;

                                default: break;
                                }
                                //gl.Execute("speedmode sm:=3");
                                gl.DataPlots.Add(dr, Origin.PLOTTYPES.IDM_PLOT_LINE);



                                // Setup the Y axis to auto adjust the scale to fit any data
                                // points that are less than or greater than the scale's range.
                                gl.Execute("layer.disp = layer.disp | hex(1000);");

                                gp.Name = CurrentWorksheet.Name;
                            }
                        }
                    }
                }
            }
        }