HelloWorld.Samples.CpuAndMemoryChart.InitAxes C# (CSharp) Method

InitAxes() private method

private InitAxes ( ) : void
return void
        private void InitAxes()
        {
            // customizes the amount to indent the Y axis.  You can do this based on typical y axis labels for your
            // scenario.
            YAxisLeftOffset = 8;

            // CPU values go from 0 to 100
            ViewModel.YMinimumOverride = 0;
            ViewModel.YMaximumOverride = 100;

            // y axis will show the past minute
            var now = DateTime.Now;
            ViewModel.XMinimumOverride = now.Ticks - TimeSpan.FromMinutes(1).Ticks;
            ViewModel.XMaximumOverride = now.Ticks;

            // show y labels that are appropriate for second granularity, since we'll add a new point every second
            XAxisValueFormatter = ChartLabelFormatters.SecondGranularityTimestamp;
            XAxisValueCompactFormatter = ChartLabelFormatters.SecondGranularityCompactTimestamp;

            // for the x values we can explicityly format it as a percentage
            YAxisValueCompactFormatter = (d) => new ConsoleString(Math.Round(d, 1) + " %");
            YAxisValueFormatter = YAxisValueCompactFormatter;
        }