示例#1
0
        public Graph(SingleGraphViewModel sgvm, SingleGraphWindow sgw, string identifier, LineSeries lineSeries)
        {
            //Get queue based on identifier
            incomingQueue          = Mqtt.GetIncomingQueue();
            this.singleGraphWindow = sgw;
            this.windowToPlotOn    = sgw;
            this.sgvm       = sgvm;
            LineSeries      = lineSeries;
            this.identifier = identifier;

            if (identifier == "xacceleration" || identifier == "yacceleration" || identifier == "zacceleration")
            {
                identifier_top = "acceleration";
                topic          = new string[] { identifier_top };
            }
            else if (identifier == "pitch" || identifier == "yaw" || identifier == "roll")
            {
                identifier_top = "orientation";
                topic          = new string[] { identifier_top };
            }

            singleGraphWindow.chart.Series.Add(LineSeries);

            sgvm.Title = SetTitle(identifier);

            Mqtt.Subscribe(topic);

            switch (identifier)
            {
            case Topic.XAccTopic:
                LineSeries.Title = "AccX";
                break;

            case Topic.YAccTopic:
                LineSeries.Title = "AccY";
                break;

            case Topic.ZAccTopic:
                LineSeries.Title = "AccZ";
                break;

            case Topic.RollTopic:
                LineSeries.Title = "Roll";
                break;

            case Topic.PitchTopic:
                LineSeries.Title = "Pitch";
                break;

            case Topic.YawTopic:
                LineSeries.Title = "Yaw";
                break;

            default:
                break;
            }

            Run();
        }
        public SideBarInfo(SensorsViewModel sensorsViewModel, SensorWindow sensorWindow)
        {
            this.sensorsViewModel = sensorsViewModel;
            this.sensorWindow     = sensorWindow;

            this.incomingQueue = Mqtt.GetIncomingQueue();
            Mqtt.Subscribe(new string[] { "temperature" });

            Run();
        }