Esempio n. 1
0
 public StringDataEntity(PlotManager plotManager, DataEntityInfo dataInfo) : base(plotManager, dataInfo)
 {
     _xBuffer  = new OverLapStrBuffer(DataInfo.Capacity);
     _yBuffers = new List <OverLapWrapBuffer <TDataType> >(DataInfo.LineCount);
     for (int i = 0; i < DataInfo.LineCount; i++)
     {
         _yBuffers.Add(new OverLapWrapBuffer <TDataType>(DataInfo.Capacity));
     }
     _plotBuffer = new PlotBuffer <TDataType>(DataInfo.LineCount, DataInfo.Capacity);
 }
Esempio n. 2
0
        public void RefreshXLabels()
        {
            if (double.IsNaN(_axisX.ScaleView.ViewMaximum) || double.IsNaN(_axisX.ScaleView.ViewMinimum) ||
                _axisX.ScaleView.ViewMaximum - _axisX.ScaleView.ViewMinimum < 1)
            {
                return;
            }
            double           labelStep      = (_axisX.ScaleView.ViewMaximum - _axisX.ScaleView.ViewMinimum) / Constants.XLabelCount;
            double           labelRangeSize = labelStep / 4;
            double           labelPosition  = _axisX.ScaleView.ViewMinimum;
            OverLapStrBuffer xLabels        = _plotter.PlotAction.XWrapBuf;
            int pointIndex;

            for (int i = 0; i < Constants.XLabelCount; i++)
            {
                _axisX.CustomLabels[i].FromPosition = labelPosition - labelRangeSize;
                _axisX.CustomLabels[i].ToPosition   = labelPosition + labelRangeSize;

                pointIndex = (int)Math.Round(labelPosition) + _samplesInChart;
                if (pointIndex >= 0 && pointIndex < xLabels.Count && !string.IsNullOrWhiteSpace(xLabels[pointIndex]))
                {
                    _axisX.CustomLabels[i].Text = xLabels[pointIndex];
                }
                else
                {
                    _axisX.CustomLabels[i].Text = " ";
                }
                labelPosition += labelStep;
            }

            // 最后一个做特殊处理
            labelPosition = 0;
            _axisX.CustomLabels[Constants.XLabelCount].FromPosition = labelPosition - labelRangeSize;
            _axisX.CustomLabels[Constants.XLabelCount].ToPosition   = labelPosition + labelRangeSize;
            pointIndex = xLabels.Count - 1;
            if (pointIndex >= 0 && !string.IsNullOrWhiteSpace(xLabels[pointIndex]))
            {
                _axisX.CustomLabels[Constants.XLabelCount].Text = xLabels[pointIndex];
            }
            else
            {
                _axisX.CustomLabels[Constants.XLabelCount].Text = " ";
            }
        }