Beispiel #1
0
        public FormRawData()
        {
            InitializeComponent();

            this.rawCurveGroup = this.chart.AddNewGroup();
            this.rawCurveGroup.XAxes.MaxScale = 100000000L;
            this.rawCurveGroup.XAxes.MinScale = 400;
            this.rawCurveGroup.XAxes.SetScale(100000);
            this.rawCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(DateTime.Now), 0);
            this.rawCurveGroup.CursorType = CurveCursorType.CURSOR_CROSSLINE;
            rawCurveGroup.XAxes.XAxesMode = XAxesMode.Relative;

            this.rawCurveGroup.DrawPointFlagXAxesScale = 500;


            this.freqCurveGroup = this.chart1.AddNewGroup();
            this.freqCurveGroup.XAxes.MaxScale = 100000000L;
            this.freqCurveGroup.XAxes.MinScale = 100;
            this.freqCurveGroup.XAxes.SetScale(100000);
            this.freqCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(DateTime.Now), 0);
            this.freqCurveGroup.CursorType = CurveCursorType.CURSOR_CROSSLINE;
            freqCurveGroup.XAxes.XAxesMode = XAxesMode.Relative;

            this.freqCurveGroup.DrawPointFlagXAxesScale = 500;

            fftPlan = new FFTPlan(secNum * 8000);
            fftIn   = new float[secNum * 8000 * 2];
            fftOut  = new float[secNum * 8000 * 2];
        }
Beispiel #2
0
        public FormDayCurve()
        {
            InitializeComponent();


            this.dayCurveGroup = this.chart.AddNewGroup();
            this.dayCurveGroup.XAxes.MaxScale = 60000000 * 60L;
            this.dayCurveGroup.XAxes.MinScale = 250000;
            this.dayCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(DateTime.Now), 0);
            this.dayCurveGroup.CursorType = CurveCursorType.CURSOR_CROSSLINE;
            this.dayCurveGroup.DrawPointFlagXAxesScale = 5000000;


            IList <HHDeviceGrp> types = HHDeviceManager.GetInstance().DeviceGroupsUnsort;


            foreach (HHDeviceGrp type in types)
            {
                if (type.AnalogProperties.Count > 0)
                {
                    comboBoxEdit1.Properties.Items.Add(type);
                }
            }
            if (comboBoxEdit1.Properties.Items.Count > 0)
            {
                comboBoxEdit1.SelectedIndex = 0;
            }

            dateEdit1.DateTime = DateTime.Now.Date;
        }
Beispiel #3
0
        private void LoadMarketWorkertranactionDoWork(object sender, DoWorkEventArgs e)
        {
            var vehicle = new VehicleViewModel()
            {
                Mileage  = _manheimVehicle.Odometer,
                Year     = _manheimVehicle.Year,
                Make     = _manheimVehicle.Make,
                Model    = _manheimVehicle.Model,
                Trim     = _manheimVehicle.Trim,
                Vin      = _manheimVehicle.Vin,
                Mmr      = _manheimVehicle.Price,
                DealerId = _dealer.DealerId
            };

            try
            {
                using (var context = new VincontrolEntities())
                {
                    var queryDealer = context.Dealers.FirstOrDefault(d => d.DealerId == vehicle.DealerId);

                    var dealer = new DealershipViewModel(queryDealer);

                    if (!String.IsNullOrEmpty(vehicle.Vin))
                    {
                        var autoService = new ChromeAutoService();

                        var vehicleInfo = autoService.GetVehicleInformationFromVin(vehicle.Vin);

                        if (vehicleInfo != null)
                        {
                            vehicle.Make = vehicleInfo.bestMakeName;

                            vehicle.Year = vehicleInfo.modelYear;

                            vehicle.Model = vehicleInfo.bestModelName;

                            if (!String.IsNullOrEmpty(vehicleInfo.bestTrimName) &&
                                !vehicleInfo.bestTrimName.Contains("/"))
                            {
                                vehicle.Trim = vehicleInfo.bestTrimName;
                            }

                            if (!String.IsNullOrEmpty(vehicleInfo.vinDescription.bodyType))
                            {
                                vehicle.BodyStyle = vehicleInfo.vinDescription.bodyType;
                            }
                        }
                    }
                    _marketData = MarketHelper.GetMarketCarsForNationwideMarketOnVinsell(vehicle, dealer);
                }
            }
            catch (Exception ex)
            {
                _marketData.Error = ex.Message;
            }
        }
 /// <summary>
 /// 布局初始化
 /// </summary>
 public void PanelInit()
 {
     CandleGraph();
     //表面
     this.chartGraph1.PicLineDrawValue     += new StockInfoLayOut(SDSDLR_PicLineDrawValue);
     this.chartGraph1.PicLineDrawValueOver += new StockInfoLayOutOver(SDSDLR_PicLineDrawValueOver);
     //临时
     ChartGraphTemp = new ChartGraph();
     this.ChartGraphTemp.StockCode             = codepath;
     this.chartGraph1.StockCode                = codepath;
     this.ChartGraphTemp.PicLineDrawValue     += new StockInfoLayOut(Temp_PicLineDrawValue);
     this.ChartGraphTemp.PicLineDrawValueOver += new StockInfoLayOutOver(Temp_PicLineDrawValueOver);
 }
Beispiel #5
0
        public static ChartGraph GetMarketDailyData(int year, string make, string model, string trim)
        {
            var context = new VinMarketEntities();

            var chartGraph = new ChartGraph();

            var query = context.daily_market.Where(x => x.Year == year);

            var searchResult = GetNationwideMarket(query, make, model, trim);



            if (searchResult != null && searchResult.Any())
            {
                chartGraph.Market = new ChartGraph.MarketInfo
                {
                    CarsOnMarket   = searchResult.Select(x => x.NoOfCarInNation).Sum().GetValueOrDefault(),
                    MinimumPrice   = searchResult.Select(x => x.BelowMarketPrice).Average().GetValueOrDefault(),
                    AveragePrice   = (int)searchResult.Select(x => x.AverageMarketPrice).Average().GetValueOrDefault(),
                    MaximumPrice   = searchResult.Select(x => x.AboveMarketPrice).Average().GetValueOrDefault(),
                    MinimumMileage = (int)Math.Round(searchResult.Select(x => x.BelowMarketMileage).Average().GetValueOrDefault()),
                    AverageMileage = (int)Math.Round(searchResult.Select(x => x.AverageMarketMileage).Average().GetValueOrDefault()),
                    MaximumMileage = (int)Math.Round(searchResult.Select(x => x.AboveMarketMileage).Average().GetValueOrDefault()),
                };

                chartGraph.Market.AboveThumbnailUrl = searchResult.First().AboveThumbnailUrl;
                chartGraph.Market.BelowThumbnailUrl = searchResult.First().BelowThumbnailUrl;
            }
            else
            {
                chartGraph.Market = new ChartGraph.MarketInfo
                {
                    CarsOnMarket = 0,
                    MinimumPrice = 0,
                    AveragePrice = 0,
                    MaximumPrice = 0,
                };
            }


            return(chartGraph);
        }
Beispiel #6
0
        public FormWav(Device dev)
            : this()
        {
            this.device = dev;


            for (int i = 0; i < listChart.Count; i++)
            {
                ChartGraph            chart = listChart[i];
                UltraChart.CurveGroup grp   = chart.AddNewGroup();
                grp.XAxes.MaxScale = 100000000L;
                grp.XAxes.MinScale = 100;
                grp.XAxes.SetScale(100000);
                grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(DateTime.Now), 0);
                grp.CursorType      = CurveCursorType.CURSOR_CROSSLINE;
                grp.XAxes.XAxesMode = XAxesMode.Relative;

                grp.DrawPointFlagXAxesScale = 500;
            }
        }
Beispiel #7
0
        public void DrawCurve()
        {
            dayCurveGroup.ClearChartObject();
            DateTime time = dateEdit1.DateTime.Date;

            this.dayCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(time), 0);

            if (selectDev == null)
            {
                return;
            }
            IList <HHDeviceProperty> listProp = selectDev.DevGroup.AnalogProperties;

            int colorIndex = -1;

            DateTime drawTime = DateTime.MinValue;

            for (int i = 0; i < listProp.Count; i++)
            {
                if (listProp[i].Selected == false)
                {
                    continue;
                }
                colorIndex++;
                HHDeviceProperty devProp = selectDev.GetProperty(listProp[i]);
                int      analogIndex     = devProp.Analog.Index;
                LineArea la = new LineArea(chart, listProp[i].Name, false);
                la.YAxes.YAxesMin = 0;
                la.YAxes.YAxesMax = 200;
                LineCurve lc = new LineCurve(chart, listProp[i].Name, 0);

                lc.LineColor = colorList[colorIndex % colorList.Length];
                la.AddLine(lc);
                lc.YAxes.Mode       = YAxesMode.Manual;
                lc.YAxes.YAxesMin   = devProp.Analog.ADMin;
                lc.YAxes.YAxesMax   = devProp.Analog.ADMax;
                lc.YAxes.UnitString = listProp[i].Unit;
                if (devProp.Analog.ADMax < 1)
                {
                    lc.YAxes.Precision = 2;
                }
                else if (devProp.Analog.ADMax < 10)
                {
                    lc.YAxes.Precision = 1;
                }
                List <AnalogRecordGroup> r = DatabaseModule.GetInstance().QueryAnalogHistory(devProp.Analog.Group.Type, analogIndex, time, time.AddDays(1));

                r.Sort();
                //不考虑回溯

                if (r != null && r.Count > 0)
                {
                    for (int m = 0; m < r.Count; m++)
                    {
                        List <AnalogRecord> records = r[m].Records;

                        for (int j = 0; j < records.Count; j++)
                        {
                            if (drawTime == DateTime.MinValue)
                            {
                                drawTime = records[j].Time;
                            }
                            else if (drawTime > records[j].Time)
                            {
                                drawTime = records[j].Time;
                            }
                            long tm = ChartGraph.DateTime2ChartTime(records[j].Time);
                            lc.AddPoint(new LinePoint(tm, records[j].Value));
                        }
                    }
                }

                dayCurveGroup.AddChartObject(la);
            }
            if (drawTime == DateTime.MinValue)
            {
                drawTime = time;
            }
            this.dayCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(drawTime), 0);
            chart.Draw();
        }
Beispiel #8
0
 public static void draw(this ChartGraph g)
 {
     // DO SOMETHING
 }
Beispiel #9
0
        private void QueryData()
        {
            if (selChannel == null)
            {
                return;
            }
            int selIndex = comboBoxEdit1.SelectedIndex;

            if (selIndex < 0)
            {
                return;
            }

            DateTime timeSel = listTimes[selIndex];

            timeQuery = timeSel.AddSeconds((timeEdit1.Time - timeEdit1.Time.Date).TotalSeconds);

            if (timeQuery < selChannel.File.BeginTime)
            {
                MessageBox.Show("查询时间小于记录开始时间!", "查询", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (timeQuery > selChannel.File.EndTime)
            {
                MessageBox.Show("查询时间大于记录开始时间!", "查询", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            int sec = (int)((timeQuery - selChannel.File.BeginTime).TotalSeconds);

            trackBarControl1.ValueChanged -= new EventHandler(trackBarControl1_ValueChanged);
            trackBarControl1.Value         = sec;
            trackBarControl1.ValueChanged += new EventHandler(trackBarControl1_ValueChanged);

            float[] data = selChannel.File.GetData(selChannel.Channel - 1, timeQuery, secNum);

            rawCurveGroup.ClearChartObject();
            freqCurveGroup.ClearChartObject();
            this.rawCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeQuery), 0);
            this.freqCurveGroup.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeQuery), 0);
            //幅度谱
            LineArea laAmpl = new LineArea(chart, "原始波形", false);

            laAmpl.YAxes.YAxesMin = 0;
            laAmpl.YAxes.YAxesMax = 200;
            LineCurve lcAmpl = new LineCurve(chart, "原始波形", 0);

            lcAmpl.LineColor = Color.Lime;
            laAmpl.AddLine(lcAmpl);
            //lc.YAxes.Mode = YAxesMode.Manual;
            lcAmpl.YAxes.YAxesMin = 0;
            lcAmpl.YAxes.YAxesMax = 100;

            if (data != null)
            {
                long startTm = ChartGraph.DateTime2ChartTime(timeQuery);
                for (int j = 0; j < data.Length; j++)
                {
                    long tm = startTm + j * 1000000L / 8000;
                    // var tm = timeQuery.AddMilliseconds(j / 8.0);
                    lcAmpl.AddPoint(new LinePoint(tm, data[j]));
                }
            }


            //频率谱
            LineArea laFreq = new LineArea(chart1, "频率谱", false);

            laFreq.YAxes.YAxesMin = 0;
            laFreq.YAxes.YAxesMax = 200;
            laFreq.XFreqScale     = 8000f / (secNum * 1000000);
            LineCurve lcFreq = new LineCurve(chart1, "频率谱", 0);

            lcFreq.LineColor = Color.Red;
            laFreq.AddLine(lcFreq);
            lcFreq.YAxes.Mode     = YAxesMode.Manual;
            lcFreq.YAxes.YAxesMin = -1;
            lcFreq.YAxes.YAxesMax = 15;

            if (data != null)
            {
                if (fftPlan.FFTNum != secNum * 8000)
                {
                    fftPlan.Dispose();
                    fftPlan = new FFTPlan(secNum * 8000);
                    fftIn   = new float[secNum * 16000];
                    fftOut  = new float[secNum * 16000];
                }

                for (int i = 0; i < data.Length; i++)
                {
                    fftIn[i * 2]     = data[i];
                    fftIn[i * 2 + 1] = 0;
                }
                fftPlan.FFTForward(fftIn, fftOut);

                long  startTm = ChartGraph.DateTime2ChartTime(timeQuery);
                float maxAmpl = 0;
                for (int j = 0; j < data.Length / 2; j++)
                {
                    long tm = startTm + j * 1000000L / 8000;
                    // var tm = timeQuery.AddMilliseconds(j / 8.0);
                    float amplVal = 0;
                    if (j > 2) //不显示直流
                    {
                        amplVal = (float)(Math.Sqrt(fftOut[2 * j] * fftOut[2 * j] + fftOut[2 * j + 1] * fftOut[2 * j + 1]) * 2 / (8000 * secNum));
                    }
                    if (amplVal > maxAmpl)
                    {
                        maxAmpl = amplVal;
                    }
                    lcFreq.AddPoint(new LinePoint(tm, amplVal));
                }

                lcFreq.YAxes.YAxesMax = maxAmpl * 1.2f;
            }

            rawCurveGroup.AddChartObject(laAmpl);
            freqCurveGroup.AddChartObject(laFreq);
            chart.Draw();
            chart1.Draw();
        }
Beispiel #10
0
        private void ProcADSample(object obj)
        {
            int channel = (int)obj;

            ADBlock block = new ADBlock(8000, 4000);

            this.device.AddADBlock(channel, block);

            try
            {
                while (true)
                {
                    short[] adData = block.GetAdData(-1);

                    if (adData == null)
                    {
                        continue;
                    }

                    if (listEnable[channel] == false)
                    {
                        continue;
                    }

                    int adMin = int.MaxValue;
                    int adMax = int.MinValue;


                    for (int i = 0; i < adData.Length; i++)
                    {
                        if (adData[i] > adMax)
                        {
                            adMax = adData[i];
                        }
                        if (adData[i] < adMin)
                        {
                            adMin = adData[i];
                        }
                    }

                    float adMaxf = adMax + (adMax - adMin) * 0.2f;

                    float adMinf = adMin - (adMax - adMin) * 0.2f;

                    this.Invoke((EventHandler) delegate
                    {
                        ChartGraph chart          = listChart[channel];
                        UltraChart.CurveGroup grp = chart.GroupList[0];
                        grp.ClearChartObject();

                        LineArea area         = new LineArea(chart, "AD曲线", true);
                        area.IsShowFoldFlag   = false;
                        area.IsFold           = false;
                        area.YAxes.Mode       = YAxesMode.Manual;
                        area.YAxes.YAxesMin   = adMinf;
                        area.YAxes.YAxesMax   = adMaxf;
                        area.YAxes.Precision  = 3;
                        area.YAxes.UnitString = "";


                        LineCurve lcAmpl = new LineCurve(chart, "原始波形", 0);

                        lcAmpl.LineColor = Color.Lime;
                        area.AddLine(lcAmpl);

                        DateTime timeNow = DateTime.Now;
                        long startTm     = ChartGraph.DateTime2ChartTime(timeNow);
                        for (int j = 0; j < adData.Length; j++)
                        {
                            long tm = startTm + j * 1000000L / 8000;
                            // var tm = timeQuery.AddMilliseconds(j / 8.0);
                            lcAmpl.AddPoint(new LinePoint(tm, adData[j]));
                        }


                        grp.AddChartObject(area);
                        grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeNow), 0);
                        chart.AutoSetXScale();


                        chart.Draw();
                    });
                }
            }
            catch (Exception ex)
            {
            }
            finally {
                this.device.RemoveADBlock(channel, block);
            }
        }
Beispiel #11
0
        private void DrawCurve()
        {
            HHDevice device = comboBoxEdit2.SelectedItem as HHDevice;

            HHDeviceProperty devProp = comboBoxEdit1.SelectedItem as HHDeviceProperty;
            DateTime         timeSel = DateTime.Now;

            if (comboBoxEdit3.SelectedIndex >= 0)
            {
                timeSel = (DateTime)comboBoxEdit3.SelectedItem;
            }



            HHDeviceProperty devBindProp = device.GetProperty(devProp);


            List <DevCurve> curves = devBindProp.Curves;

            UltraChart.CurveGroup grp = chart.GroupList[0];
            grp.ClearChartObject();

            LineArea area = new LineArea(chart, "道岔曲线", true);

            area.IsShowFoldFlag   = false;
            area.IsFold           = false;
            area.YAxes.Mode       = YAxesMode.Manual;
            area.YAxes.YAxesMin   = curves[0].ADMin;
            area.YAxes.YAxesMax   = curves[0].ADMax;
            area.YAxes.Precision  = 3;
            area.YAxes.UnitString = "";
            grp.AddChartObject(area);
            grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeSel), 0);
            chart.AutoSetXScale();


            List <StationCurve> listCurve = DataStorage.DatabaseModule.GetInstance().QueryCurveHistory(curves[0].Group.Type, curves[0].Index, timeSel);


            string[][] curveNames = new string[][] {
                new string[] { "曲线" },
                new string[] { "曲线1", "曲线2" },
                new string[] { "A相", "B相", "C相" },
            };

            for (int i = 0; i < curves.Count; i++)
            {
                LineCurve line = new LineCurve(chart, curveNames[curves.Count - 1][i], 0);
                line.LineColor = ColorList[i % ColorList.Length];
                area.AddLine(line);
                if (listCurve != null && listCurve.Count > 0 && listCurve[i] != null)
                {
                    for (int j = 0; j < listCurve[i].Points.Length; j++)
                    {
                        DateTime  time  = timeSel.AddMilliseconds(curves[i].TimeInterval * j); //40毫秒
                        LinePoint point = new LinePoint();
                        point.Value = listCurve[i].Points[j];
                        point.Time  = ChartGraph.DateTime2ChartTime(time);
                        line.AddPoint(point);
                    }
                }
            }
            chart.AutoSetXScale();
            chart.Draw();
        }