public ConstantChangesChart() { InitializeComponent(); lsEfficiency.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Efficiency); lsPulse.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Pulse); lsRed.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Red); lsGreen.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Green); lsBlue.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Blue); DataContext = this; }
public static void SetMapper <T>(IMapper mapper) { _lock.EnterWriteLock(); try { if (Mappers.GetMapper(typeof(T), mapper) is StandardMapper) { Mappers.Register(typeof(T), mapper); } } finally { _lock.ExitWriteLock(); } }
public LineChart() { InitializeComponent(); TempValues.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Temp); RpmValues.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Rpm); Rpm_cValues.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Rpm_c); TorqueValues.Configuration = Mappers.Xy <FactoryTelemetry>().X(ft => ft.TimeStamp.Ticks).Y(ft => ft.Torque); AllCharts(); }
public UcBatteryChart() { InitializeComponent(); dateRange.DateTo = DateTime.Today; dateRange.DateFrom = DateTime.Today; DataContext = this; c.Series.Configuration = Mappers.Xy <DateTimeBatteryInfo>() .X(p => p.DateTime.Ticks) .Y(p => p.Value) .Fill(p => p.IsCharging ? Brushes.Green : (p.Value < 20 ? Brushes.Red : Brushes.DarkBlue)); axisX.LabelFormatter = value => new DateTime((long)value).ToString("dd日HH时"); s.Values = Values; }
static DropDownPoint() { //In this case we are plotting our own point to have //more control over the current plot //configuring a custom type is quite simple //first we define a mapper var mapper = Mappers.Pie <DropDownPoint>() .Value(x => x.Value);//use the value property in the plot //then we save the mapper globally, there are many ways //so configure a series, for more info see: //https://lvcharts.net/App/examples/v1/wpf/Types%20and%20Configuration Charting.For <DropDownPoint>(mapper); }
public async Task <UserModel?> GetUserAsync(string username) { if (string.IsNullOrEmpty(username)) { throw new ArgumentException("Argument was null or empty.", nameof(username)); } return(await Task.Run(() => { var user = _unitOfWork.GetRepository <IUserRepository>() .Find(u => u.Username == username) .FirstOrDefault(); return user is null ? null : Mappers.ToUserModel(user); })); }
public IMapContext For <T>(Action <IJsonObjectMapper <T> > configure) { Guarder.CheckNull(configure, nameof(configure)); var type = typeof(T); if (!Mappers.ContainsMapper(type)) { Mappers.PushMapper(type); } var mapper = Mappers.GetMapper(type); var jsonObjMapper = new JsonObjectMapper <T>(mapper, Configuration); configure(jsonObjMapper); return(this); }
//List<Brush> SeriesColors = new List<Brush>(); public UC_LiveLineChartMulti() { InitializeComponent(); ColorList = typeof(Brushes).GetProperties() .Select(x => x.GetValue(null) as Brush) .ToArray(); var mapper = Mappers.Xy <double[]>() .X(model => model[0]) //use DateTime.Ticks as X .Y(model => model[1]); //use the value property as Y Charting.For <double []>(mapper); DataContext = this; }
public LinqExample() { InitializeComponent(); //lets configure the chart to plot cities Mapper = Mappers.Xy <City>() .X((city, index) => index) .Y(city => city.Population); MillionFormatter = value => (value / 1000000).ToString("N") + "M"; this.Loading += LinqExample_Loading; DataContext = this; }
public Post SavePost(string text) { PostModel postModel = new PostModel { Owner = _db.UserModels.FirstOrDefault(um => um.NickName == User.Identity.Name) == null?_db.UserModels.FirstOrDefault(um => um.Id == 1) : _db.UserModels.FirstOrDefault(um => um.NickName == User.Identity.Name), Text = text, Time = DateTime.Now.ToString(), OwnerId = _db.UserModels.FirstOrDefault(um => um.NickName == User.Identity.Name)?.Id ?? 1, Rating = 0 }; _db.PostModels.Add(postModel); _db.SaveChanges(); return(Mappers.BuildPost(postModel)); }
public HiveTemperatureControl() { InitializeComponent(); //Creating FIRESHARP client client = new FireSharp.FirebaseClient(config); //To handle live data easily, in this case we built a specialized type //the MeasureModel class, it only contains 2 properties //DateTime and Value //We need to configure LiveCharts to handle MeasureModel class //The next code configures MeasureModel globally, this means //that LiveCharts learns to plot MeasureModel and will use this config every time //a IChartValues instance uses this type. //this code ideally should only run once //you can configure series in many ways, learn more at //http://lvcharts.net/App/examples/v1/wpf/Types%20and%20Configuration var mapper = Mappers.Xy <MeasureModelHiveTemperature>() .X(model => model.DateTimeHiveTemperature.Ticks) //use DateTime.Ticks as X .Y(model => model.ValueHiveTemperature); //use the value property as Y //lets save the mapper globally. Charting.For <MeasureModelHiveTemperature>(mapper); //the values property will store our values array ChartValuesHiveTemperature = new ChartValues <MeasureModelHiveTemperature>(); //lets set how to display the X Labels DateTimeFormatterHiveTemperature = value => new DateTime((long)value).ToString("mm:ss"); //AxisStep forces the distance between each separator in the X axis AxisStep = TimeSpan.FromSeconds(10).Ticks; //AxisUnit forces lets the axis know that we are plotting seconds //this is not always necessary, but it can prevent wrong labeling AxisUnit = TimeSpan.TicksPerSecond; SetAxisLimits(DateTime.Now); //The next code simulates data changes every 300 ms Task.Factory.StartNew(export); YFormatterHiveTemperature = valueHiveTemperature => valueHiveTemperature + valueHiveTemperature.ToString(" °C"); DataContext = this; }
private void LoadTransactionsIntoChart() { if (!_transactions.Any()) { return; } var dayConfig = Mappers.Xy <DateModel>() .X(dateModel => dateModel.DateTime.ToFileTimeUtc()) .Y(dateModel => dateModel.Value); var sortedTransactions = GetSortedTransactions(_transactions); HandlePossibleFirstDayMissingTransaction(sortedTransactions); PopulateMissingDates(sortedTransactions, _transactions); var chartValues = new ChartValues <DateModel>(); chartValues.Add(new DateModel { DateTime = sortedTransactions.First().Key.Subtract(TimeSpan.FromDays(1)), Value = (double)(_transactions.First().AccountBalance - _transactions.First().Value), }); foreach (var transaction in sortedTransactions) { chartValues.Add(new DateModel { DateTime = transaction.Key, Value = transaction.Value, }); } SeriesCollection = new SeriesCollection(dayConfig) { new LineSeries { Title = "Account Balance", Values = chartValues }, }; YFormatter = value => { var dateTime = DateTime.FromFileTimeUtc((long)value); return(dateTime.ToShortDateString()); }; }
private void SetupChart() { PerformanceValue = new ChartValues <ObservableValue> { new ObservableValue(100), new ObservableValue(100), new ObservableValue(100), new ObservableValue(100) }; AvailabilityValue = new ChartValues <ObservableValue> { new ObservableValue(100), new ObservableValue(100), new ObservableValue(100), new ObservableValue(100) }; var Mapper = Mappers.Xy <ObservableValue>() .X((item, index) => index) .Y(item => item.Value); var performanceLine = new LineSeries { Values = PerformanceValue, StrokeThickness = 4, Fill = Brushes.Transparent, PointGeometrySize = 0, DataLabels = true, Configuration = Mapper, }; var availabilityLine = new LineSeries { Values = AvailabilityValue, StrokeThickness = 4, Fill = Brushes.Transparent, PointGeometrySize = 0, DataLabels = true, Configuration = Mapper }; PerformanceChart = new SeriesCollection { performanceLine, availabilityLine }; XAxis = new[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; //YFormatter = value => value.ToString("%"); }
public BollingerBandsView(BollingerBandsStrategy currBollingerBandsStrategy) { InitializeComponent(); this.StrategyBollingerBands = currBollingerBandsStrategy; var mapper = Mappers.Xy <MeasureModel>() .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X .Y(model => model.Value); //use the value property as Y //lets save the mapper globally. Charting.For <MeasureModel>(mapper); //the values property will store our values array ChartValuesPrice = new ChartValues <MeasureModel>(); ChartValuesUpperBand = new ChartValues <MeasureModel>(); ChartValuesMiddleBand = new ChartValues <MeasureModel>(); ChartValuesLowerBand = new ChartValues <MeasureModel>(); //lets set how to display the X Labels DateTimeFormatter = value => new DateTime((long)value).ToString("hh:mm:ss"); AxisStep = TimeSpan.FromSeconds(1).Ticks; SetAxisLimits(DateTime.Now); //The next code simulates data changes every 1000 ms Timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(1000) }; Timer.Tick += TimerOnTick; IsDataInjectionRunning = false; DataContext = this; if (IsDataInjectionRunning) { Timer.Stop(); IsDataInjectionRunning = false; } else { Timer.Start(); IsDataInjectionRunning = true; } //this.Foreground = new SolidColorBrush(Colors.Red); //this.Background = new SolidColorBrush(Colors.Yellow); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //Configurando el componente de log4net log4net.Config.XmlConfigurator.Configure(); //Configurando el AutoMapper Mappers.MappingDTO(); //Aplicando Inyección por dependencia DIConfig.ConfigureInjector(); }
public static async Task <string> CreateCustomersAsync(AuthenticationProvider authenticationProvider, Client customer) { try { // Converter objeto order para invoice CustomerResource resource = Mappers.ToCustomer(customer); // Inserir invoice do IE return(await CustomerController.InsertCustomerToIEAsync(authenticationProvider, resource).ConfigureAwait(false)); } catch (Exception exception) { throw new ExecutionEngineException(exception.Message); } }
public SuccessStoryAchievementsGraphics(SeriesCollection StatsGraphicAchievementsSeries, IList <string> StatsGraphicsAchievementsLabels) { InitializeComponent(); //let create a mapper so LiveCharts know how to plot our CustomerViewModel class var customerVmMapper = Mappers.Xy <CustomerForSingle>() .X((value, index) => index) .Y(value => value.Values); //lets save the mapper globally Charting.For <CustomerForSingle>(customerVmMapper); StatsGraphicAchievements.Series = StatsGraphicAchievementsSeries; StatsGraphicAchievementsX.Labels = StatsGraphicsAchievementsLabels; //StatsGraphicAchievementsY.MinValue = -1; }
public static async Task <string> CreateInvoiceMiddlewareAsync(AuthenticationProvider authenticationProvider, OrderResource order) { try { // Converter objeto order para invoice InvoiceProcessResource resource = Mappers.ToInvoiceProcess(order); // Inserir invoice do IE return(await MiddlewareController.InsertInvoiceToIEAsync(authenticationProvider, resource).ConfigureAwait(false)); } catch (Exception exception) { throw new Exception(exception.Message); } }
public PriceChartViewModel() { PriceHistory = new SeriesCollection( Mappers.Xy <PriceHistoryViewModel>() .X(dayModel => (double)dayModel.Time.Ticks / TimeSpan.FromHours(1).Ticks) .Y(dayModel => dayModel.Price)); PriceHistory.Add( new LineSeries { Title = "Price (£)", Values = new ChartValues <PriceHistoryViewModel>() }); XFormatter = value => new DateTime((long)(value < 0 ? 0 : value * TimeSpan.FromHours(1).Ticks)).ToString("HH:mm:ss"); }
/// <summary> /// /// </summary> /// <param name="t"></param> /// <param name="callback"></param> public static void RevokeMapper(Action callback) { var t = typeof(App); var map = Mappers.GetMapper(t, null); Mappers.Revoke(map); var foo = new FooMapper(); Mappers.Register(t.Assembly, foo); try { callback(); } catch (Exception ex) { throw ex; } finally { Mappers.Revoke(foo); Mappers.Register(t.Assembly, map); } }
public PsApiManagement SetApiManagementService( PsApiManagement apiManagement, bool createSystemResourceIdentity, string[] userAssignedIdentity) { ApiManagementServiceResource apiManagementParameters = Mappers.MapPsApiManagement(apiManagement); apiManagementParameters.Identity = Mappers.MapAssignedIdentity(createSystemResourceIdentity, userAssignedIdentity); var apiManagementService = Client.ApiManagementService.CreateOrUpdate( apiManagement.ResourceGroupName, apiManagement.Name, apiManagementParameters); return(new PsApiManagement(apiManagementService)); }
public StatisticsViewModel(ILogService log, IDataSourceService service, IUserNotifyer notifyer) { _notifyer = notifyer; _log = log; _service = service; FormatterDay = m => new DateTime((long)m).ToString("dd MMM yyyy"); FormatterMonth = m => new DateTime((long)m).ToString("MMM yyyy"); FormatterHour = m => new DateTime((long)m).ToString("HH:00"); FormatterCount = m => $"{m} hit(s)"; XyDateTimeMapper = Mappers.Xy <ChartPoint <DateTime, int> >() .X(p => p.X.Ticks) .Y(p => p.Y); }
public SuccessStoryAchievementsGraphics() { InitializeComponent(); //let create a mapper so LiveCharts know how to plot our CustomerViewModel class var customerVmMapper = Mappers.Xy <CustomerForSingle>() .X((value, index) => index) .Y(value => value.Values); //lets save the mapper globally Charting.For <CustomerForSingle>(customerVmMapper); PluginDatabase.PropertyChanged += OnPropertyChanged; }
internal PsApiManagementCustomHostNameConfiguration(HostnameConfiguration hostnameConfigurationResource) : this() { if (hostnameConfigurationResource == null) { throw new ArgumentNullException("hostnameConfigurationResource"); } CertificateInformation = hostnameConfigurationResource.Certificate != null ? new PsApiManagementCertificateInformation(hostnameConfigurationResource.Certificate) : null; Hostname = hostnameConfigurationResource.HostName; KeyVaultId = hostnameConfigurationResource.KeyVaultId; IdentityClientId = hostnameConfigurationResource.IdentityClientId; DefaultSslBinding = hostnameConfigurationResource.DefaultSslBinding; NegotiateClientCertificate = hostnameConfigurationResource.NegotiateClientCertificate; HostnameType = Mappers.MapHostnameType(hostnameConfigurationResource.Type); }
public async Task <IActionResult> Update(string name) { if (name != null) { User user = await _userManager.FindByEmailAsync(name); if (user.Id != CurrentUserId) { return(BadRequest()); } UserUpdateViewModel userUpdateViewModel = Mappers.MapUserToUserUpdateVM(user); userUpdateViewModel.AvatarPath = _fileService.GetAvatarPath(CurrentUserId); return(View(userUpdateViewModel)); } return(NotFound()); }
public MonitorTemplate(MonitorFactory input)//Modified Constructor { InitializeComponent(); mf = input; this.Show(); // this is temp measuremodel input <<>> var mapper = Mappers.Xy <MeasureModel>() .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X .Y(model => model.Value); //use the value property as Y //lets save the mapper globally. Charting.For <MeasureModel>(mapper); //the ChartValues property will store our values array ChartValues = new ChartValues <MeasureModel>(); ChartValues2 = new ChartValues <MeasureModel>(); cartesianChart1.Series = new SeriesCollection { new LineSeries { Title = "Rain", Values = ChartValues, PointGeometrySize = 18, StrokeThickness = 3 }, new LineSeries { Title = "Temperature", Values = ChartValues2, PointGeometrySize = 18, StrokeThickness = 3 } }; cartesianChart1.AxisX.Add(new Axis { DisableAnimations = true, LabelFormatter = value => "", Separator = new Separator { Step = TimeSpan.FromSeconds(20).Ticks } }); SetAxisLimits(System.DateTime.Now); }
private void UpdateChart(List <IStockPrice> data) { splitContainer.Panel2.Controls.Clear(); if (data != null && data.Any()) { var dayConfig = Mappers.Xy <ChartModel>() .X(dayModel => (double)dayModel.DateTime.Ticks / TimeSpan.FromSeconds(1).Ticks) .Y(dayModel => dayModel.Value); CartesianChart chart = new CartesianChart(); ChartValues <ChartModel> max2 = new ChartValues <ChartModel>(); ChartValues <ChartModel> min2 = new ChartValues <ChartModel>(); foreach (var item in data) { max2.Add(new ChartModel(item.Date, item.Max)); min2.Add(new ChartModel(item.Date, item.Min)); } chart.Series = new SeriesCollection(dayConfig) { new LineSeries { Title = "Max", Values = max2, }, new LineSeries { Title = "Min", Values = min2, }, }; chart.AxisX.Add(new Axis { LabelFormatter = DateLabelFormater, }); chart.LegendLocation = LegendLocation.Right; splitContainer.Panel2.Controls.Add(chart); chart.Dock = DockStyle.Fill; chart.Zoom = ZoomingOptions.Xy; chart.Pan = PanningOptions.Xy; } }
public GraphPage() { InitializeComponent(); var dayConfig = Mappers.Xy <DateModel>() .X(dayModel => (double)dayModel.DateTime.Ticks / TimeSpan.FromHours(1).Ticks) .Y(dayModel => dayModel.Value); //Notice you can also configure this type globally, so you don't need to configure every //SeriesCollection instance using the type. //more info at http://lvcharts.net/App/Index#/examples/v1/wpf/Types%20and%20Configuration var i = 1; Series = new SeriesCollection(dayConfig) { new LineSeries { Values = new ChartValues <DateModel> { new DateModel { DateTime = System.DateTime.Now, Value = i } }, Fill = new SolidColorBrush(Windows.UI.Colors.Transparent) }, }; var temp = new DateModel(); for (var j = 1; j < 50; j++) { AddDataModel(new DateModel { DateTime = System.DateTime.Now, Value = i++ }); Thread.Sleep(100); } Formatter = value => new System.DateTime((long)(value * TimeSpan.FromHours(1).Ticks)).ToString("t"); DataContext = this; }
/// <summary> /// /// </summary> private void LoadLiveCharts() { try { //To handle live data easily, in this case we built a specialized type //the MeasureModel class, it only contains 2 properties //DateTime and Value //We need to configure LiveCharts to handle MeasureModel class //The next code configures MEasureModel globally, this means //that livecharts learns to plot MeasureModel and will use this config every time //a ChartValues instance uses this type. //this code ideally should only run once, when application starts is reccomended. //you can configure series in many ways, learn more at http://lvcharts.net/App/examples/v1/wpf/Types%20and%20Configuration var mapper = Mappers.Xy <MeasureModel>() .X(model => model.DateTime.Ticks) //use DateTime.Ticks as X .Y(model => model.Value); //use the value property as Y //lets save the mapper globally. Charting.For <MeasureModel>(mapper); //the values property will store our values array ChartValues = new ChartValues <MeasureModel>(); //lets set how to display the X Labels DateTimeFormatter = value => new DateTime((long)value).ToString("mm:ss"); AxisStep = TimeSpan.FromSeconds(1).Ticks; SetAxisLimits(DateTime.Now); //The next code simulates data changes every 300 ms Timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(1000) }; Timer.Tick += TimerOnTick; IsDataInjectionRunning = false; R = new Random(); DataContext = this; } catch (Exception ex) { logger.LogError("Exception in LoadLiveCharts, Message : " + ex.Message); } }
private int series_counter; // number of series plotted, zero-indexed /// <summary> /// Initialises a new instance of the NumberRadiusChart class. /// </summary> public NumberRadiusChart() { x_axis_title = "Number of Particles"; y_axis_title = "Aggregate Radius"; // create a mapper using NumberRadiusMeasureModel where // X co-ord is ParticleNumber and Y co-ord is Radius. CartesianMapper <NumberRadiusMeasureModel> mapper = Mappers.Xy <NumberRadiusMeasureModel>() .X(model => model.ParticleNumber) .Y(model => model.AggregateRadius); // save the mapper globally Charting.For <NumberRadiusMeasureModel>(mapper); SeriesCollection = new SeriesCollection(); series_counter = -1; ResetAxisProperties(); PollingInterval = 100U; }