|
|
@ -492,6 +492,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
|
|
|
|
_lChartAll.BeginUpdate();
|
|
|
|
_lChartAll.BeginUpdate();
|
|
|
|
if (isStartRealData)
|
|
|
|
if (isStartRealData)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
currentOATime = 0;
|
|
|
|
_data = new double[smList.Count * 3][];
|
|
|
|
_data = new double[smList.Count * 3][];
|
|
|
|
StartChart();
|
|
|
|
StartChart();
|
|
|
|
//Set real-time monitoring automatic old data destruction
|
|
|
|
//Set real-time monitoring automatic old data destruction
|
|
|
@ -937,12 +938,15 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
|
|
|
|
{
|
|
|
|
{
|
|
|
|
service.RemoveStartFromList(item.Key);
|
|
|
|
service.RemoveStartFromList(item.Key);
|
|
|
|
tempData.Add(item.Key+ firstTime);
|
|
|
|
tempData.Add(item.Key+ firstTime);
|
|
|
|
if (offset < 100)
|
|
|
|
if (offset < 60)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// 不能超过缓存数, 更新数据
|
|
|
|
// 不能超过缓存数, 更新数据
|
|
|
|
var time = currentTime.AddSeconds(-offset);
|
|
|
|
var time = currentTime.AddSeconds(-offset);
|
|
|
|
var tem = item.Value.datas[time.ToOADate()];
|
|
|
|
int iCount= item.Value.datas.Count;
|
|
|
|
item.Value.datas[time.ToOADate()] = datasStr.ToArray();
|
|
|
|
if (iCount - offset > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item.Value.datas[iCount - offset] = datasStr.ToArray();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data = service.Get(item.Key, 0, 0).FirstOrDefault();
|
|
|
|
data = service.Get(item.Key, 0, 0).FirstOrDefault();
|
|
|
|
if (data == null) break;
|
|
|
|
if (data == null) break;
|
|
|
@ -972,20 +976,27 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
|
|
|
|
//有新数据开始刷新
|
|
|
|
//有新数据开始刷新
|
|
|
|
if (tempData.Count > 5)
|
|
|
|
if (tempData.Count > 5)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
List<double> temDou = new List<double>();
|
|
|
|
DateTime startTime = DateTime.Today;
|
|
|
|
foreach (var item in subNameList)
|
|
|
|
foreach (var item in subNameList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var d = item.Value.datas.Keys.OrderBy(a => a).ToArray();
|
|
|
|
List<double> temDou = new List<double>();
|
|
|
|
for (int i = 0; i < d.Count(); i++)
|
|
|
|
var number = item.Value.datas.Count;
|
|
|
|
|
|
|
|
for (int i = 0; i < number; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
temDou.AddRange(item.Value.datas[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_data[item.Value.Index] = temDou.ToArray();
|
|
|
|
|
|
|
|
if (startTime == DateTime.Today)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
temDou.AddRange(item.Value.datas[d[i]]);
|
|
|
|
startTime = DateTime.FromOADate(item.Value.StartOATime).AddSeconds(-item.Value.datas.Count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// _data[item.Value.Index] = temDou.ToArray();
|
|
|
|
|
|
|
|
// DateTime time1 = DateTime.Now.AddMinutes(i++);
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.XAxes[0].SetRange(_lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(time1),
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(time1.AddSeconds(60)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// isRefresh = true;
|
|
|
|
_lChartAll.ViewXY.XAxes[0].SetRange(_lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime),
|
|
|
|
|
|
|
|
_lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime.AddSeconds(30)));
|
|
|
|
|
|
|
|
LChartALL.ViewXY.DropOldSeriesData = true;
|
|
|
|
|
|
|
|
_pointsAppended = LChartALL.ViewXY.XAxes[0].Minimum;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isRefresh = true;
|
|
|
|
tempData.Clear();
|
|
|
|
tempData.Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_dispatcher.Invoke(() =>
|
|
|
|
_dispatcher.Invoke(() =>
|
|
|
@ -996,44 +1007,52 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
|
|
|
|
double time2 = stopwatch.ElapsedMilliseconds;
|
|
|
|
double time2 = stopwatch.ElapsedMilliseconds;
|
|
|
|
Debug.WriteLine("timeFrame:{0},time1:{1},time1:{2}", DateTime.FromOADate(currentOATime), time1, time2);
|
|
|
|
Debug.WriteLine("timeFrame:{0},time1:{1},time1:{2}", DateTime.FromOADate(currentOATime), time1, time2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int _iRound = 0;
|
|
|
|
|
|
|
|
double _pointsAppended = 0;
|
|
|
|
double _pointsAppended = 0;
|
|
|
|
double[][] _data;
|
|
|
|
double[][] _data;
|
|
|
|
|
|
|
|
|
|
|
|
private void FeedData(bool isRefresh)
|
|
|
|
private void FeedData(bool isRefresh)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_lChartAll != null)
|
|
|
|
if (_lChartAll == null) return;
|
|
|
|
{
|
|
|
|
|
|
|
|
_lChartAll.BeginUpdate();
|
|
|
|
_lChartAll.BeginUpdate();
|
|
|
|
if(isRefresh)
|
|
|
|
if (isRefresh)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (int seriesIndex = 0; seriesIndex < _channelCount; seriesIndex++)
|
|
|
|
for (int seriesIndex = 0; seriesIndex < _channelCount; seriesIndex++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_lChartAll.ViewXY.SampleDataSeries[seriesIndex].Clear();
|
|
|
|
_lChartAll.ViewXY.SampleDataSeries[seriesIndex].Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//foreach (var item in subNameList.Values)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// startTime = DateTime.FromOADate(item.StartOATime).AddSeconds(item.datas.Count);
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.XAxes[0].SetRange(_lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime),
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime.AddSeconds(60)));
|
|
|
|
|
|
|
|
// LChartALL.ViewXY.DropOldSeriesData = true;
|
|
|
|
|
|
|
|
// _pointsAppended = LChartALL.ViewXY.XAxes[0].Minimum;
|
|
|
|
|
|
|
|
// var number = item.datas.Count;
|
|
|
|
|
|
|
|
// for (int i = 0; i < number; i++)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// foreach (var d in subNameList)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// double[] thisSeriesData = subNameList[d.Key].datas[i];
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.SampleDataSeries[d.Value.Index].AddSamples(thisSeriesData, false);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// _pointsAppended += 1;
|
|
|
|
|
|
|
|
// //Set X axis real-time scrolling position
|
|
|
|
|
|
|
|
// double last = _pointsAppended;
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.XAxes[0].ScrollPosition = last;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
//}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Append data to series
|
|
|
|
//Append data to series
|
|
|
|
for (int seriesIndex = 0; seriesIndex < _channelCount; seriesIndex++)
|
|
|
|
for (int seriesIndex = 0; seriesIndex < _channelCount; seriesIndex++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
double[] thisSeriesData = _data[seriesIndex];
|
|
|
|
double[] thisSeriesData = _data[seriesIndex];
|
|
|
|
if(thisSeriesData==null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(thisSeriesData, false);
|
|
|
|
_lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(thisSeriesData, false);
|
|
|
|
_data[seriesIndex] = null;
|
|
|
|
_data[seriesIndex] = null;
|
|
|
|
// System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1},time:{2}", seriesIndex,
|
|
|
|
// System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1},time:{2}", seriesIndex,
|
|
|
|
// _lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount, DateTime.Now);
|
|
|
|
// _lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount, DateTime.Now);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//System.Threading.Tasks.Parallel.For(0, _channelCount, (seriesIndex) =>
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// double[] thisSeriesData = _data[seriesIndex];
|
|
|
|
|
|
|
|
// double[] dataToAppendNow = new double[_samplingFrequency];
|
|
|
|
|
|
|
|
// Array.Copy(thisSeriesData, 0, dataToAppendNow, 0, _samplingFrequency);
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(_data[seriesIndex], false);
|
|
|
|
|
|
|
|
// System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1},time:{2}", seriesIndex,
|
|
|
|
|
|
|
|
// _lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount, DateTime.Now);
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
_pointsAppended += 1;
|
|
|
|
_pointsAppended += 1;
|
|
|
|
|
|
|
|
|
|
|
|
//Set X axis real-time scrolling position
|
|
|
|
//Set X axis real-time scrolling position
|
|
|
@ -1043,7 +1062,6 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
|
|
|
|
//Update sweep bands
|
|
|
|
//Update sweep bands
|
|
|
|
if (_lChartAll.ViewXY.XAxes[0].ScrollMode == XAxisScrollMode.Sweeping)
|
|
|
|
if (_lChartAll.ViewXY.XAxes[0].ScrollMode == XAxisScrollMode.Sweeping)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
//Dark band of old page fading away
|
|
|
|
//Dark band of old page fading away
|
|
|
|
double pageLen = _lChartAll.ViewXY.XAxes[0].Maximum - _lChartAll.ViewXY.XAxes[0].Minimum;
|
|
|
|
double pageLen = _lChartAll.ViewXY.XAxes[0].Maximum - _lChartAll.ViewXY.XAxes[0].Minimum;
|
|
|
|
double sweepGapWidth = pageLen / 20.0;
|
|
|
|
double sweepGapWidth = pageLen / 20.0;
|
|
|
@ -1076,8 +1094,6 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_lChartAll.EndUpdate();
|
|
|
|
_lChartAll.EndUpdate();
|
|
|
|
|
|
|
|
|
|
|
|
_iRound++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
|