Example #1
0
        private static CGPath CalculatePath(PlotDataSet dataSet)
        {
            if (dataSet == null || dataSet.DataPoints == null ||
                dataSet.DataPoints.Count == 0)
            {
                return(null);
            }

            var firstPoint = dataSet.DataPoints[0];

            var path = new CGPath();

            path.MoveToPoint((nfloat)firstPoint.X, (nfloat)firstPoint.Y);

            foreach (var dataPoint in dataSet.DataPoints.Skip(1))
            {
                path.AddLineToPoint((nfloat)dataPoint.X, (nfloat)dataPoint.Y);
            }

            return(path);
        }
        public void CreatePlotDataSubscriptionTables()
        {
            int          i, j;
            PlotDataSet  new_data_set;
            VariableInfo vi;

            // Exit if no plot item exist
            if (PlotItems.Instance.Count == 0)
            {
                return;
            }
            // Get ordered x variable names
            CaptureSettingManager.Instance.GetOrderedXVarNames(out orderedXVar);
            // Get ordered y variable names
            PlotItems.Instance.GetYVarNames(orderedXVar, out orderedYVar);
            // Instantiate tables
            plotDataSubscriptionTables = new PlotDataSets[orderedXVar.Count];
            // For each capture period setting
            for (i = 0; i < orderedXVar.Count; i++)
            {
                // Instantiate a table
                plotDataSubscriptionTables[i] = new PlotDataSets();
                // Create x variable data set
                vi           = VariableManager.Instance.GetVariable(orderedXVar[i]);
                new_data_set = new PlotDataSet(orderedXVar[i], vi.type);
                // Add x variable
                plotDataSubscriptionTables[i].Add(new_data_set);
                // Add y variable
                for (j = 0; j < orderedYVar[i].Count; j++)
                {
                    // Create y variable data set
                    vi           = VariableManager.Instance.GetVariable(orderedYVar[i][j]);
                    new_data_set = new PlotDataSet(orderedYVar[i][j], vi.type);
                    plotDataSubscriptionTables[i].Add(new_data_set);
                }
            }
        }