private void listFiles_ItemChecked(object sender, RoutedEventArgs e) { List <CheckboxNameColorList.StringAndColorList> selList = listFiles.GetSelectedFiles(); if (selList.Count == 0) { trendChart.Series.Clear(); trendChart.Visible = false; return; } foreach (ChartInfo info in chartList) { if (!selList.Exists(selitem => (string)selitem.Tag == info.title)) //去掉没有选择的图形 { trendChart.Series.Remove(info.chart); } } foreach (CheckboxNameColorList.StringAndColorList selitem in selList) //增加新选择的图形 { ChartInfo info = chartList.Find(chartitem => chartitem.title == (string)selitem.Tag); //在chartList中查找所选内容 if (trendChart.Series.FindByName((string)info.title) == null) //如果该图形没有增加,新增 { trendChart.Series.Add(info.chart); } } AdjustAxisValue(); trendChart.Visible = true; }
private ChartInfo GetWorkedTimeVsDayData(GenerateChartArguments args) { ChartPointsList workedTimeList = new ChartPointsList(); ChartPointsList activeTimeList = new ChartPointsList(); ChartPointsList inactiveTimeList = new ChartPointsList(); ChartInfo info = new ChartInfo(); info.Arguments = args; DateTime curDate = args.FromDate; DateTime toDate = args.ToDate; while (curDate <= toDate) { if (worker.CancellationPending) { return(null); } int workedTime = TasksSummaries.GetWorkedTime(curDate, curDate); if (workedTime != 0) { int activeTime = TasksSummaries.GetActiveTime(curDate, curDate); int inactiveTime = workedTime - activeTime; string date = curDate.ToShortDateString(); info.AddX(date); workedTimeList.Add(Convert.ToDouble(workedTime * 1.0 / 3600)); activeTimeList.Add(Convert.ToDouble(activeTime * 1.0 / 3600)); inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 1.0 / 3600)); } curDate = curDate.AddDays(1); } info.PointsList = new ChartPointsList[] { workedTimeList, activeTimeList, inactiveTimeList }; return(info); }
public static void updateEverageDataAfterDelete(ChartInfo chartInfo) { bool isMonitor = (chartInfo.sleepMode == (int)SleepMode.Monitor); string key = isMonitor ? "Monitor" : "Suppress"; int leftChartNum = PlayerPrefs.GetInt("savedNum" + key, 0) - 1; if (leftChartNum <= 0) { PlayerPrefs.SetInt("savedNum" + key, 0); PlayerPrefs.SetString("savedEverage" + key, ""); } else { string savedEverage = PlayerPrefs.GetString("savedEverage" + key, ""); string[] tmpEverages = savedEverage.Split('_'); if (tmpEverages.Length == 3) { PlayerPrefs.SetInt("savedNum" + key, leftChartNum); var new_pKaiMin = (float.Parse(tmpEverages[0]) * (leftChartNum + 1) - chartInfo.pKaiMin) / leftChartNum; var new_pIbiki = (float.Parse(tmpEverages[1]) * (leftChartNum + 1) - chartInfo.pIbiki) / leftChartNum; var new_pMukokyu = (float.Parse(tmpEverages[2]) * (leftChartNum + 1) - chartInfo.pMukokyu) / leftChartNum; PlayerPrefs.SetString("savedEverage" + key, new_pKaiMin + "_" + new_pIbiki + "_" + new_pMukokyu); } else { //Reset PlayerPrefs.SetInt("savedNum" + key, 0); PlayerPrefs.SetString("savedEverage" + key, ""); } } }
public void initInfoForChartEverage() { string[] unreadFileList = CSVManager.getUnreadCsvFileList(this.fileList, this.chartPref.savedLastFileName); foreach (var filePath in unreadFileList) { List <SleepData> sleepData = CSVManager.readSleepDataFromCsvFile(filePath); ChartInfo chartInfo = CSVManager.convertSleepDataToChartInfo(sleepData); if (chartInfo != null) { CSVManager.convertSleepHeaderToChartInfo(chartInfo, filePath); if (chartInfo.sleepMode == (int)SleepMode.Monitor) { this.chartsOfMonitor.Add(chartInfo); } else { this.chartsOfSuppress.Add(chartInfo); } } } this.showChartEverage(chartsOfMonitor, SleepMode.Monitor); this.showChartEverage(chartsOfSuppress, SleepMode.Suppress); int fileNum = unreadFileList.Length; if (fileNum > 0) { this.chartPref.saveLastFileName(Kaimin.Common.Utility.TransFilePathToDate(unreadFileList[fileNum - 1]).ToString()); } }
public void RemoveChart(ChartInfo chart) { m_charts.Remove(chart.ID, out var _); Exec("DELETE FROM Charts WHERE setId=? AND fileName=?", chart.SetID, chart.FileName); Exec("DELETE FROM LocalChartConfig WHERE chartId=?", chart.ID); }
public IPanelMapper Select(IEnumerable <Step> steps, ChartInfo chartInfo) { var panelsUsed = steps .Select(s => s.Panels | (s.ExtraPanels ?? 0)) .SelectMany(_stepPanelSplitter.Split) .Distinct() .ToArray(); var eligibleMappers = _panelMappers .Where(m => (chartInfo?.PlayerCount == null || chartInfo.PlayerCount == m.PlayerCount) && panelsUsed.Select(m.Map).All(p => p != null)) .Distinct() .ToArray(); if (eligibleMappers.Length == 0) { _logger.Warning($"No eligible mappers for {chartInfo?.PlayerCount} player(s) and {chartInfo?.PanelCount} panel(s)"); } else if (eligibleMappers.Length > 1) { var mapperNames = eligibleMappers.Select(m => m.GetType().Name).ToArray(); _logger.Debug($"Multiple eligible mappers for {chartInfo?.PlayerCount} player(s) and {chartInfo?.PanelCount} panel(s)"); _logger.Debug($"Eligible mappers: {string.Join(", ", mapperNames)}"); var chosenMapper = eligibleMappers.OrderBy(m => m.PanelCount).First(); return(chosenMapper); } return(eligibleMappers.FirstOrDefault()); }
public List <ChartInfo> GetServiceTypeRatings() { var serviceRatings = new List <ChartInfo>(); var serviceList = Enum.GetValues(typeof(ServiceType)).Cast <ServiceType>(); foreach (var service in serviceList) { var ratings = _orderRepository .GetAll() .Where(x => x.Rating != 0 && x.Type == service) .Select(x => x.Rating) .ToList(); var avgRating = ratings.Any() ? ratings.Average() : 0; var chartInfo = new ChartInfo(service.GetDisplayName(), Math.Round(avgRating, 2)); serviceRatings.Add(chartInfo); } serviceRatings = serviceRatings.OrderByDescending(m => m.Data).ToList(); return(serviceRatings); }
public void saveData(bool isMonitor, ChartInfo chartEverage, int chartNum) { string key = isMonitor ? "Monitor" : "Suppress"; PlayerPrefs.SetInt("savedNum" + key, chartNum); PlayerPrefs.SetString("savedEverage" + key, chartEverage.pKaiMin + "_" + chartEverage.pIbiki + "_" + chartEverage.pMukokyu); }
private ChartInfo GetPercentActiveTimeVsMonthData(GenerateChartArguments args) { ChartPointsList activeTimeList = new ChartPointsList(); ChartPointsList inactiveTimeList = new ChartPointsList(); ChartInfo info = new ChartInfo(); info.Arguments = args; DateTime curDate = args.FromDate; DateTime toDate = args.ToDate; while (curDate <= toDate) { if (worker.CancellationPending) { return(null); } DateTime endcurDate = curDate.AddMonths(1).AddSeconds(-1); int workedTime = TasksSummaries.GetWorkedTime(curDate, endcurDate); if (workedTime != 0) { int activeTime = TasksSummaries.GetActiveTime(curDate, endcurDate); int inactiveTime = workedTime - activeTime; string month = curDate.ToString("MMM-yyyy"); info.AddX(month); activeTimeList.Add(Convert.ToDouble(activeTime * 100.0 / workedTime)); inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 100.0 / workedTime)); } curDate = curDate.AddMonths(1); } info.PointsList = new ChartPointsList[] { activeTimeList, inactiveTimeList }; return(info); }
private void ChartCollectedData(ChartInfo chartInfo) { if (chartInfo.Arguments.SelectedChart == 1) { ChartWorkedTimeVsDay(chartInfo); } else if (chartInfo.Arguments.SelectedChart == 2) { ChartWorkedTimeVsWeek(chartInfo); } else if (chartInfo.Arguments.SelectedChart == 3) { ChartWorkedTimeVsMonth(chartInfo); } else if (chartInfo.Arguments.SelectedChart == 4) { ChartPercentActiveTimeVsDay(chartInfo); } else if (chartInfo.Arguments.SelectedChart == 5) { ChartPercentActiveTimeVsWeek(chartInfo); } else if (chartInfo.Arguments.SelectedChart == 6) { ChartPercentActiveTimeVsMonth(chartInfo); } }
private Vector2 GetPointPosition(ChartInfo chartInfo, int pointIndex) { double range = chartInfo.yMaxValue - chartInfo.yMinValue; float x = chartInfo.xPositions[pointIndex]; float y = (float)(chartInfo.originY + (chartInfo.yValues[pointIndex] - chartInfo.yMinValue) / range * chartInfo.chartHeight); return(new Vector2(x, y)); }
private void DrawChartContent(ChartInfo chartInfo) { DrawChartLines(chartInfo); DrawChartDots(chartInfo); chartInfo.tooltip.transform.SetAsLastSibling(); }
public Chart LoadFromFile(ChartInfo chartInfo) { string fileName = Path.Combine(ParentDirectory, chartInfo.Set.FilePath, chartInfo.FileName); var ksh = KshChart.CreateFromFile(fileName); var chart = ksh.ToVoltex(chartInfo); return(chart); }
public void showChartWeekByPage(int page) { this.chartsOfWeek = new List <ChartInfo>(); BarChart[] barChartWeeks = { barChartWeek1, barChartWeek2, barChartWeek3, barChartWeek4, barChartWeek5, barChartWeek6, barChartWeek7 }; BarPercentWeek[] barPercentWeeks = { barPercentWeek1, barPercentWeek2, barPercentWeek3, barPercentWeek4, barPercentWeek5, barPercentWeek6, barPercentWeek7 }; if (page > 0) { string[] pageFileList = CSVManager.getCsvFileListByPage(this.fileList, page); foreach (var filePath in pageFileList) { List <SleepData> sleepData = CSVManager.readSleepDataFromCsvFile(filePath); ChartInfo chartInfo = CSVManager.convertSleepDataToChartInfo(sleepData); if (chartInfo != null) { chartInfo.endSleepTime = sleepData.Select(data => data.GetDateTime()).Last(); CSVManager.convertSleepHeaderToChartInfo(chartInfo, filePath); this.chartsOfWeek.Add(chartInfo); } } } int chartCount = this.chartsOfWeek.Count; if (chartCount > 0) { this.lbChartTitle.text = MSG_RECENT_PART; if (chartCount > 1) { this.lbChartTitle.text += "(" + this.chartsOfWeek[0].date + "~" + this.chartsOfWeek[chartCount - 1].date + ")"; } for (int i = 0; i < chartCount; i++) { ChartInfo chartInfo = this.chartsOfWeek[i]; barChartWeeks[i].drawBarChart(chartInfo.pKaiMin, chartInfo.pIbiki, chartInfo.pMukokyu); barPercentWeeks[i].drawChartInfoWeek(chartInfo.pKaiMin, chartInfo.pIbiki, chartInfo.pMukokyu, chartInfo.date, chartInfo.sleepTime, chartInfo.sleepMode, chartInfo.vibrationStrength); } for (int i = chartCount; i < barChartWeeks.Length; i++) { barChartWeeks[i].drawBarChartWhenEmpty(); barPercentWeeks[i].drawChartInfoWeekWhenEmpty(); } } else { //Show no chart week this.txtNoDataWeek.text = MSG_NO_DATA; this.lbChartTitle.text = MSG_RECENT_PART; for (int i = 0; i < barChartWeeks.Length; i++) { barChartWeeks[i].drawBarChartWhenEmpty(); barPercentWeeks[i].drawChartInfoWeekWhenEmpty(); } } }
public void RemoveChartFromCollection(string collectionName, ChartInfo chart) { if (m_collections.TryGetValue(collectionName, out var collection) && collection.ChartIds.Contains(chart.ID)) { Exec("DELETE FROM Collections WHERE collection=? AND chartId=?", collectionName, chart.ID); collection.ChartIds.Remove(chart.ID); } }
/// <summary> /// Uses Annual Chart Info to create Quarterly chart /// </summary> /// <param name="annualChartInfo"></param> /// <param name="row"></param> /// <param name="chart"></param> /// <param name="title"></param> public void ChartQuarterly(ChartInfo annualChartInfo, DataRow row, Chart chart, string title) { var qChartInfo = GetQuartChartInfo(annualChartInfo); chart.OpenData(COD.Values, qChartInfo.NSeries, Const.QuarterlyCount); Task.Factory.StartNew(() => PlotChart(row, chart, qChartInfo)); //SetChartTitle(chart, title); chart.CloseData(COD.Values); }
public void showChartEverage(List <ChartInfo> chartInfos, SleepMode sleepMode) { bool isMonitor = (sleepMode == SleepMode.Monitor); ChartInfo chartEverage = new ChartInfo(); BarChart barChartE = isMonitor ? this.barChart1 : this.barChart2; BarPercent barPercentE = isMonitor ? this.barPercent1 : this.barPercent2; //Load saved info int savedChartNum = isMonitor ? this.chartPref.savedNumMonitor : this.chartPref.savedNumSuppress; if (savedChartNum > 0) { string savedEverage = isMonitor ? this.chartPref.savedEverageMonitor : this.chartPref.savedEverageSuppress; string[] tmpEverages = savedEverage.Split('_'); if (tmpEverages.Length == 3) { chartEverage.pKaiMin = float.Parse(tmpEverages[0]) * savedChartNum; chartEverage.pIbiki = float.Parse(tmpEverages[1]) * savedChartNum; chartEverage.pMukokyu = float.Parse(tmpEverages[2]) * savedChartNum; } else { savedChartNum = 0; //Reset } } int chartNum = chartInfos.Count + savedChartNum; if (chartNum > 0) { foreach (var chartInfo in chartInfos) { chartEverage.pKaiMin += chartInfo.pKaiMin; chartEverage.pIbiki += chartInfo.pIbiki; chartEverage.pMukokyu += chartInfo.pMukokyu; } chartEverage.pKaiMin = chartEverage.pKaiMin / chartNum; chartEverage.pIbiki = chartEverage.pIbiki / chartNum; chartEverage.pMukokyu = chartEverage.pMukokyu / chartNum; barChartE.drawBarChart(chartEverage.pKaiMin, chartEverage.pIbiki, chartEverage.pMukokyu); barPercentE.drawChartInfo(chartEverage.pKaiMin, chartEverage.pIbiki, chartEverage.pMukokyu, (int)sleepMode); this.chartPref.saveData(isMonitor, chartEverage, chartNum); this.txtNoDataEverage.text = ""; } else { //Empty chart barChartE.drawBarChartWhenEmpty(); barPercentE.drawChartInfoWhenEmpty(); } }
public void AddChartToCollection(string collectionName, ChartInfo chart) { CreateCollection(collectionName); var collection = m_collections[collectionName]; if (!collection.ChartIds.Contains(chart.ID)) { Exec("INSERT INTO Collections (collection, chartId) VALUES (?,?)", collectionName, chart.ID); collection.ChartIds.Add(chart.ID); } }
internal GameLayer(ClientResourceLocator resourceLocator, ChartInfo chartInfo, AutoPlayTargets autoPlay = AutoPlayTargets.None) : base(resourceLocator, "game/main") { m_locator = resourceLocator; m_chartInfo = chartInfo; m_autoPlay = autoPlay; m_gaugeType = GaugeType.Normal; m_background = new ScriptableBackground(m_locator); }
private void PlotChart(DataRow selectedRow, Chart chart, ChartInfo charttinfo) { object item = null; int nValue = 0; int nSeries = 0; int j = 0; nValue = charttinfo.Nvalues; nSeries = charttinfo.NSeries; j = 1; chart.BeginInvoke((MethodInvoker) delegate { //set x-axis labels for (int i = nValue; i >= 1; i += -1) { item = selectedRow[charttinfo.Perend + i.ToString()]; if (((!object.ReferenceEquals(item, DBNull.Value)) && (!(i % 2 == 0)))) { chart.AxisX.Label[0 + (nValue - i)] = System.DateTime.Parse(item.ToString()).ToString("MM/yy"); } else { chart.AxisX.Label[0 + (nValue - i)] = ""; } } chart.AxisY.ForceZero = false; chart.AxisY.LabelsFormat.Format = AxisFormat.Currency; chart.AxisX.TickMark = TickMark.Outside; chart.AxisX.LabelAngle = 0; //charttinfo.nSeries Step -1 'charttinfo.nSeries - 1 ' 2 To 2 '1 To charttinfo.nSeries for (j = 0; j <= (nSeries - 1); j++) { //quarterly totextp for (int i = nValue; i >= 1; i += -1) { item = selectedRow[charttinfo.colName[j] + i.ToString()]; if (((!object.ReferenceEquals(item, DBNull.Value)))) { // Running on the UI thread chart.Value[j, 0 + (nValue - i)] = Convert.ToDouble(item); } else { //chart.Value[j, 0 + (ii - i)] = null; } } chart.Series[j].Color = charttinfo.LineStyles[j].LineColor; chart.Series[j].LineStyle = charttinfo.LineStyles[j].DashStyle; chart.Series[j].Legend = charttinfo.legend[j]; } }); }
public static ChartInfo convertSleepHeaderToChartInfo(ChartInfo chartInfo, string filePath) { var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); StreamReader reader = new StreamReader(stream); string[] profileInfo = reader.ReadLine().Split(','); //CsvFileの1行目 (Row 0) reader.ReadLine(); //Skip Row 1 string[] sleepRecordStartTimeLine = reader.ReadLine().Split(','); //CsvFileの3行目 (Row 2) string sleepTime = ""; if (chartInfo.endSleepTime != null && sleepRecordStartTimeLine.Length >= 3) { string date = sleepRecordStartTimeLine[0]; string time = sleepRecordStartTimeLine[2]; string[] dateArr = date.Split('/'); string[] timeArr = time.Split(':'); int year = int.Parse(dateArr[0]); int month = int.Parse(dateArr[1]); int day = int.Parse(dateArr[2]); int hour = int.Parse(timeArr[0]); int min = int.Parse(timeArr[1]); int sec = int.Parse(timeArr[2]); chartInfo.startSleepTime = new DateTime(year, month, day, hour, min, sec); int sleepTimeSec = Graph.Time.GetDateDifferencePerSecond(chartInfo.startSleepTime, chartInfo.endSleepTime); System.TimeSpan ts = new System.TimeSpan(hours: 0, minutes: 0, seconds: sleepTimeSec); int hourWithDay = 24 * ts.Days + ts.Hours; // 24時間超えた場合の時間を考慮 sleepTime = string.Format("{0:00}:{1:00}", hourWithDay, ts.Minutes); } DateTime fileDateTime = Kaimin.Common.Utility.TransFilePathToDate(filePath); chartInfo.realDateTime = getRealDateTime(fileDateTime); chartInfo.fileName = fileDateTime.ToString(); chartInfo.sleepTime = sleepTime; chartInfo.date = isInvalidDate(chartInfo.realDateTime) ? "ー" : chartInfo.realDateTime.ToString("M/d"); if (sleepRecordStartTimeLine.Length > 9) //New format { chartInfo.sleepMode = int.Parse(sleepRecordStartTimeLine[8]); chartInfo.vibrationStrength = int.Parse(sleepRecordStartTimeLine[9]); } else { //Default chartInfo.sleepMode = (int)SleepMode.Suppress; chartInfo.vibrationStrength = (int)VibrationStrength.Medium; } return(chartInfo); }
/// <summary> /// Converts Annual Data to Quarterly Data /// </summary> /// <param name="chartInfo">Annual Chart Info</param> /// <returns>Quarterly Chart Info</returns> public ChartInfo GetQuartChartInfo(ChartInfo chartInfo) { ChartInfo resultInfo = new ChartInfo(); resultInfo.Perend = "perend_q"; resultInfo.LineStyles.AddRange(chartInfo.LineStyles); resultInfo.colName = ChangeColNameToQuart(chartInfo.colName); resultInfo.legend = chartInfo.legend.ToArray(); resultInfo.NSeries = chartInfo.NSeries; resultInfo.Nvalues = Const.QuarterlyCount; return(resultInfo); }
internal ChartResultLayer(ClientResourceLocator resourceLocator, ChartInfo chartInfo, ScoringResult result) : base(resourceLocator) { m_locator = resourceLocator; m_chartInfo = chartInfo; m_result = result; m_script["layer"] = m_layerTable = m_script.NewTable(); m_layerTable["chartInfo"] = m_chartInfoTable = m_script.NewTable(); m_layerTable["result"] = m_resultTable = m_script.NewTable(); m_script.InitNeuroSonicEnvironment(); }
private void ChartPercentActiveTimeVsMonth(ChartInfo info) { zg.GraphPane.Title.Text = info.Arguments.ChartTitle; zg.GraphPane.XAxis.Title.Text = "Month"; zg.GraphPane.YAxis.Title.Text = "%"; zg.GraphPane.XAxis.Type = AxisType.Text; zg.GraphPane.XAxis.Scale.FontSpec.Angle = 80; zg.GraphPane.XAxis.Scale.TextLabels = (string[])info.XAxisData.ToArray(typeof(string)); zg.GraphPane.AddCurve("% Active time", null, (double[])info.PointsList[0].YAxisData.ToArray(typeof(double)), Color.Green); zg.GraphPane.AddCurve("% Inactive time", null, (double[])info.PointsList[1].YAxisData.ToArray(typeof(double)), Color.Red); zg.AxisChange(); this.Refresh(); }
/// <summary> /// 将缓存区域中的健身信息放入文件中 /// </summary> void transferDataToFile() { List <List <Object> > saveData = new List <List <object> >(); for (int i = 0; i < MAX_BUFFER; i++) { ChartInfo info = bufData[0]; List <Object> convert = csv.getOriginData (info.CurrentTime, info.Speed, info.HeartBeat, info.Distance, info.Energy); saveData.Add(convert); bufData.RemoveAt(0); } csv.writeManyDataInCsv(saveData, FILE_NAME); isProcessing = false; }
public ChartInfo GetChartInfo(SaleInfoDTO saleInfo) { var specificSaleInfo = GetSaleInfo().Where(x => x.ManagerName == saleInfo.ManagerName).ToList(); ChartInfo chartInfo = new ChartInfo(); foreach (var item in specificSaleInfo) { if (!chartInfo.Products.Contains(item.ProductName)) { chartInfo.Products.Add(item.ProductName); chartInfo.Count.Add(specificSaleInfo.Count(x => x.ProductName == item.ProductName) * item.ProductPrice); chartInfo.Summ += (specificSaleInfo.Count(x => x.ProductName == item.ProductName) * item.ProductPrice); } } return(chartInfo); }
private void ChartWorkedTimeVsWeek(ChartInfo info) { zg.GraphPane.Title.Text = info.Arguments.ChartTitle; zg.GraphPane.XAxis.Title.Text = "Week"; zg.GraphPane.YAxis.Title.Text = "Hrs."; zg.GraphPane.XAxis.Type = AxisType.Text; zg.GraphPane.XAxis.Scale.FontSpec.Angle = 80; zg.GraphPane.XAxis.Scale.TextLabels = (string[])info.XAxisData.ToArray(typeof(string)); zg.GraphPane.AddCurve("Worked time", null, (double[])info.PointsList[0].YAxisData.ToArray(typeof(double)), Color.Blue); zg.GraphPane.AddCurve("Active time", null, (double[])info.PointsList[1].YAxisData.ToArray(typeof(double)), Color.Green); zg.GraphPane.AddCurve("Inactive time", null, (double[])info.PointsList[2].YAxisData.ToArray(typeof(double)), Color.Red); zg.AxisChange(); this.Refresh(); }
private Player <Playable> TCMPlayable(string filePath, Koioto.Support.FileReader.Courses courses) { var medley = GetOpenTaikoChartMedley(filePath); var chartInfo = new ChartInfo(); chartInfo.Title = new string[medley.Charts.Length]; // コースの読み込み。 foreach (var item in medley.Charts) { var course = GetCoursesFromStirng(item.Difficulty); } return(null); }
public Chart LoadFromFile(ChartInfo chartInfo) { string chartFile = Path.Combine(ParentDirectory, chartInfo.Set.FilePath, chartInfo.FileName); // TODO(local): We don't need to be creating chart factories like this aaa but it's a start Chart chart = m_gameMode.GetChartFactory().CreateNew(); //chart.GameMode = m_gameMode; // this is done by the factory, because it's required. chart.Offset = chartInfo.ChartOffset; chart.Info = chartInfo; var jobj = JObject.Load(new JsonTextReader(new StreamReader(File.OpenRead(chartFile)))); dynamic jobjdyn = jobj; JArray controlPoints = jobjdyn.controlPoints; JArray lanes = jobjdyn.lanes;
public void initInfoForChartLatest() { //Latest chart int chartCount = this.chartsOfWeek.Count; if (chartCount > 0) { ChartInfo chartInfo = this.chartsOfWeek[chartCount - 1]; this.barChart3.drawBarChart(chartInfo.pKaiMin, chartInfo.pIbiki, chartInfo.pMukokyu); this.barPercent3.drawChartInfo(chartInfo.pKaiMin, chartInfo.pIbiki, chartInfo.pMukokyu, chartInfo.sleepMode, chartInfo.vibrationStrength); } else { this.txtNoDataLatest.text = MSG_NO_DATA; this.barChart3.drawBarChartWhenEmpty(); this.barPercent3.drawChartInfoWhenEmpty(); } }
private void ChartWorkedTimeVsWeek(ChartInfo info) { zg.GraphPane.Title.Text = info.Arguments.ChartTitle; zg.GraphPane.XAxis.Title.Text = "Week"; zg.GraphPane.YAxis.Title.Text = "Hrs."; zg.GraphPane.XAxis.Type = AxisType.Text; zg.GraphPane.XAxis.Scale.FontSpec.Angle = 80; zg.GraphPane.XAxis.Scale.TextLabels = (string[])info.XAxisData.ToArray(typeof(string)); zg.GraphPane.AddCurve("Worked time", null, (double[])info.PointsList[0].YAxisData.ToArray(typeof(double)), Color.Blue); zg.GraphPane.AddCurve("Active time", null, (double[])info.PointsList[1].YAxisData.ToArray(typeof(double)), Color.Green); zg.GraphPane.AddCurve("Inactive time", null, (double[])info.PointsList[2].YAxisData.ToArray(typeof(double)), Color.Red); zg.AxisChange(); this.Refresh(); }
private void ChartPercentActiveTimeVsMonth(ChartInfo info) { zg.GraphPane.Title.Text = info.Arguments.ChartTitle; zg.GraphPane.XAxis.Title.Text = "Month"; zg.GraphPane.YAxis.Title.Text = "%"; zg.GraphPane.XAxis.Type = AxisType.Text; zg.GraphPane.XAxis.Scale.FontSpec.Angle = 80; zg.GraphPane.XAxis.Scale.TextLabels = (string[])info.XAxisData.ToArray(typeof(string)); zg.GraphPane.AddCurve("% Active time", null, (double[])info.PointsList[0].YAxisData.ToArray(typeof(double)), Color.Green); zg.GraphPane.AddCurve("% Inactive time", null, (double[])info.PointsList[1].YAxisData.ToArray(typeof(double)), Color.Red); zg.AxisChange(); this.Refresh(); }
private ChartInfo GetPercentActiveTimeVsDayData(GenerateChartArguments args) { ChartPointsList activeTimeList = new ChartPointsList(); ChartPointsList inactiveTimeList = new ChartPointsList(); ChartInfo info = new ChartInfo(); info.Arguments = args; DateTime curDate = args.FromDate; DateTime toDate = args.ToDate; while (curDate <= toDate) { if (worker.CancellationPending) return null; int workedTime = TasksSummaries.GetWorkedTime(curDate, curDate); if (workedTime != 0) { int activeTime = TasksSummaries.GetActiveTime(curDate, curDate); int inactiveTime = workedTime - activeTime; string date = curDate.ToShortDateString(); info.AddX(date); activeTimeList.Add(Convert.ToDouble(activeTime * 100.0 / workedTime)); inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 100.0 / workedTime)); } curDate = curDate.AddDays(1); } info.PointsList = new ChartPointsList[] { activeTimeList, inactiveTimeList }; return info; }
private ChartInfo GetPercentActiveTimeVsMonthData(GenerateChartArguments args) { ChartPointsList activeTimeList = new ChartPointsList(); ChartPointsList inactiveTimeList = new ChartPointsList(); ChartInfo info = new ChartInfo(); info.Arguments = args; DateTime curDate = args.FromDate; DateTime toDate = args.ToDate; while (curDate <= toDate) { if (worker.CancellationPending) return null; DateTime endcurDate = curDate.AddMonths(1).AddSeconds(-1); int workedTime = TasksSummaries.GetWorkedTime(curDate, endcurDate); if (workedTime != 0) { int activeTime = TasksSummaries.GetActiveTime(curDate, endcurDate); int inactiveTime = workedTime - activeTime; string month = curDate.ToString("MMM-yyyy"); info.AddX(month); activeTimeList.Add(Convert.ToDouble(activeTime * 100.0 / workedTime)); inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 100.0 / workedTime)); } curDate = curDate.AddMonths(1); } info.PointsList = new ChartPointsList[] { activeTimeList, inactiveTimeList }; return info; }
private ChartInfo GetWorkedTimeVsWeekData(GenerateChartArguments args) { ChartPointsList workedTimeList = new ChartPointsList(); ChartPointsList activeTimeList = new ChartPointsList(); ChartPointsList inactiveTimeList = new ChartPointsList(); ChartInfo info = new ChartInfo(); info.Arguments = args; DateTime curDate = args.FromDate; DateTime toDate = args.ToDate; while (curDate <= toDate) { if (worker.CancellationPending) return null; DateTime endcurDate = curDate.AddDays(7).AddSeconds(-1); int workedTime = TasksSummaries.GetWorkedTime(curDate, endcurDate); if (workedTime != 0) { int activeTime = TasksSummaries.GetActiveTime(curDate, endcurDate); int inactiveTime = workedTime - activeTime; string week = curDate.ToShortDateString() + "-" + endcurDate.ToShortDateString(); info.AddX(week); workedTimeList.Add(Convert.ToDouble(workedTime * 1.0 / 3600)); activeTimeList.Add(Convert.ToDouble(activeTime * 1.0 / 3600)); inactiveTimeList.Add(Convert.ToDouble(inactiveTime * 1.0 / 3600)); } curDate = curDate.AddDays(7); } info.PointsList = new ChartPointsList[] { workedTimeList, activeTimeList, inactiveTimeList }; return info; }
private void ChartCollectedData(ChartInfo chartInfo) { if (chartInfo.Arguments.SelectedChart == 1) ChartWorkedTimeVsDay(chartInfo); else if (chartInfo.Arguments.SelectedChart == 2) ChartWorkedTimeVsWeek(chartInfo); else if (chartInfo.Arguments.SelectedChart == 3) ChartWorkedTimeVsMonth(chartInfo); else if (chartInfo.Arguments.SelectedChart == 4) ChartPercentActiveTimeVsDay(chartInfo); else if (chartInfo.Arguments.SelectedChart == 5) ChartPercentActiveTimeVsWeek(chartInfo); else if (chartInfo.Arguments.SelectedChart == 6) ChartPercentActiveTimeVsMonth(chartInfo); }