static public void Log(string str, Color color, bool force = false) { if (isOpen || force) { Debug.Log(ColorUtil.ColorString(color, str)); } }
private void ConfigDailyChart() { ConfigDaily = Helper.GetLineChartConfig("Brazil Covid-19 Daily Evolution", "Days", "Victims"); casesPerDaySet = new LineDataset <Point> { BackgroundColor = ColorUtil.ColorString(0, 255, 0, 1.0), BorderColor = ColorUtil.ColorString(0, 0, 255, 1.0), Label = "New Cases", Fill = false, PointBackgroundColor = ColorUtil.ColorString(0, 0, 255, 1.0), BorderWidth = 1, PointRadius = 3, PointBorderWidth = 1, SteppedLine = SteppedLine.False, }; deathsPerDaySet = new LineDataset <Point> { BackgroundColor = ColorUtil.ColorString(255, 0, 0, 1.0), BorderColor = ColorUtil.ColorString(255, 0, 0, 1.0), Label = "New Deaths", Fill = false, BorderWidth = 1, PointRadius = 2, PointBorderWidth = 1, SteppedLine = SteppedLine.False }; }
private void MapStateToProps(AppState state, WorldByCountryChartProps props) { _barChartConfig.Data.Datasets.Clear(); _barChartConfig.Data.Labels.Clear(); props.ChartConfig = _barChartConfig; var stats = state?.CountriesData; if (stats == null) { return; } var data = stats.ByCountry.OrderByDescending(c => c.Cases).Take(20).ToArray(); _barChartConfig.Data.Labels.AddRange(data.Select(c => c.Country)); var activeDataSet = new BarDataset <Int32Wrapper> { Label = "Active", BackgroundColor = "#3f51b5", BorderColor = ColorUtil.ColorString(0, 0, 0), BorderWidth = 1 }; activeDataSet.AddRange(data.Select(c => c.Active).Wrap()); _barChartConfig.Data.Datasets.Add(activeDataSet); var recoveredDataSet = new BarDataset <Int32Wrapper> { Label = "Recovered", BackgroundColor = "#008C00", BorderColor = ColorUtil.ColorString(0, 0, 0), BorderWidth = 1 }; recoveredDataSet.AddRange(data.Select(c => c.Recovered).Wrap()); _barChartConfig.Data.Datasets.Add(recoveredDataSet); var deathDataSet = new BarDataset <Int32Wrapper> { Label = "Deaths", BackgroundColor = "#e53935", BorderColor = ColorUtil.ColorString(0, 0, 0), BorderWidth = 1 }; deathDataSet.AddRange(data.Select(c => c.Deaths).Wrap()); _barChartConfig.Data.Datasets.Add(deathDataSet); }
public async static Task <BarChartConfig> GetBarChartConfig() { var weatherService = new OpenWeatherService(); var forecastData = await weatherService.GetForecastAsync(XamEnvMonitor.Blazor.Constants.City); var orderedData = forecastData.ForeCastList.OrderBy(x => x.DateTimeStamp).Take(8).Select(y => new { Date = y.DateText, Temp = y.Main.Temp }).ToList(); var values = orderedData.Select(x => x.Temp).ToList(); var dynValues = new List <dynamic>(); foreach (var value in values) { dynValues.Add(value); } var barChartConfig = new BarChartConfig() { CanvasId = "forcastBarChartCanvas", Options = new BarChartOptions { Text = "24 Hour Forecast", Display = true, Responsive = true }, Data = new BarChartData { Labels = orderedData.Select(x => x.Date).ToList(), Datasets = new List <BaseBarChartDataset> { new BarChartDataset { Label = "Temperature", BackgroundColor = ColorUtil.ColorString(0, 50, 255), BorderColor = ColorUtil.ColorString(0, 255, 128), Data = dynValues } } } }; return(barChartConfig); }
private void SetMarker(HexNodeMarker marker) { if (selectNode != null && marker != null) { int routes = crtQuest.grid.QueryRoute(selectNode, marker); if (routes < 1) { GameEvent.PopTip(ColorUtil.ColorString(Color.red, "×")); } else { selectNode.marker = marker; if (updateNodeEvent != null) { crtQuest.needSave = true; updateNodeEvent(selectNode); } } } }