Esempio n. 1
0
        /// <summary>
        /// Updates the plot with new data.
        /// </summary>
        /// <param name="data"></param>
        public void Update(double[] data, string xAxisLabel, string yAxisLabel)
        {
            liveChartValues.AddRange(data);

            ScottPlotChart.plt.Clear();
            ScottPlotChart.plt.PlotSignal(liveChartValues.ToArray(), markerSize: 0);

            ScottPlotChart.plt.Style(chartStyle);
            ScottPlotChart.plt.Colorset(Colorset.Category10);
            ScottPlotChart.plt.YLabel(yAxisLabel);
            ScottPlotChart.plt.XLabel(xAxisLabel);
            ScottPlotChart.plt.Legend();
            ScottPlotChart.Render();

            SetAxisLimitsToAuto();

            if (ValuesStackPanel.Children.Count == 0)
            {
                var unit = UnitOfMeasureManager.GetUnitOfMeasure(yAxisLabel);
                ValuesStackPanel.Children.Add(new ChartValue(yAxisLabel, /*liveChartValues.Last(),*/ unit == null ? "" : unit.UnitOfMeasure, "" /*, "#4d4d4d", 0*/));
            }
            else
            {
                foreach (ChartValue item in ValuesStackPanel.Children)
                {
                    item.SetChannelValue(liveChartValues.Last());
                }
            }
        }
Esempio n. 2
0
        private ChartValue AddEmptySideValue(string channelName)
        {
            var unit = UnitOfMeasureManager.GetUnitOfMeasure(channelName);

            if (unit == null)
            {
                unit = UnitOfMeasureManager.GetUnitOfMeasure(channelName.Replace("_", ""));
            }

            var chartValue = new ChartValue(channelName: channelName,
                                            unitOfMeasure: unit == null ? "" : unit.UnitOfMeasure,
                                            groupName: ChartName);

            return(chartValue);
        }
        public InputFileChannelSettingsItem(Channel channel, int inputFileID)
        {
            InitializeComponent();

            channelName = channel.Name;
            ChannelID   = channel.ID;
            ID          = inputFileID;
            colorCode   = channel.Color;
            ChangeColor((Color)ColorConverter.ConvertFromString(colorCode));
            ChannelName = channel.Name;

            var unitOfMeasure = UnitOfMeasureManager.GetUnitOfMeasure(channel.Name);

            if (unitOfMeasure != null)
            {
                unitOfMeasureFormula = unitOfMeasure.UnitOfMeasure;
                var formula = @"\color[HTML]{" + ColorManager.Secondary900[1..] + "}{" + unitOfMeasure.UnitOfMeasure + "}";