public ChartMaker(ChartConfiguration configuration) { var list = new List <string>() { configuration.File, configuration.Role, configuration.OutFile, configuration.Counter, configuration.Scale.ToString(), configuration.Interval.ToString(), configuration.FullLoadTime.ToString() }; _configurationComplete = list.Any(configProp => !String.IsNullOrEmpty(configProp) && !String.IsNullOrWhiteSpace(configProp)); _configuration = configuration; SelectRecords(); MakeChart(); }
static void Main(string[] args) { //Memory\Committed MBytes try { var chartConfiguration1 = new ChartConfiguration() { File = @"C:\Users\tsmelvin\Desktop\PR-UUW47F.csv", OutFile = @"C:\Users\tsmelvin\Desktop\PR-UUW47F_cpu.png", Role = "PR-UUW47F", Counter = @"Processor(_Total)\% Processor Time", Scale = 100.0, Interval = 10.0, FullLoadTime = 30 }; var chartMaker = new ChartMaker(chartConfiguration1); chartMaker.SaveChart(); /* var chartConfiguration2 = new ChartConfiguration() * { * File = @"C:\Users\tsmelvin\Desktop\PR-UUD23.csv", * OutFile = @"C:\Users\tsmelvin\Desktop\PR-UUD23_ram.png", * Role = "PR-UUD23", * Counter = @"Memory\Committed MBytes", * Scale = 3277.0, * Interval = 200.0, * FullLoadTime = 30 * }; * * chartMaker = new ChartMaker(chartConfiguration2); * chartMaker.SaveChart();*/ Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex); Console.ReadLine(); } }
public ChartOptions(ElementReference bindTo, ChartConfiguration configuration) : this(bindTo) { configuration.Data ??= new(); if (configuration.Data.Columns == null && configuration.Data.Rows == null && configuration.Data.DataObjects == null) { configuration.Data.Columns = Array.Empty <ColumnsCollection>(); } Data = configuration.Data; Axis = configuration.Axis; Size = configuration.Size; Padding = configuration.Padding; Color = configuration.Color; Interaction = configuration.Interaction; Transition = configuration.Transition; Subchart = configuration.Subchart; Zoom = configuration.Zoom; }
private ChartConfiguration CreateServerConfiguration() { var dataSets = new List <DataSetItem>(); DataSetItem dataSetItem = new DataSetItem() { Label = "Issues", Data = new List <int?> { 30, 60, 90 }, BackgroundColor = LibChart.Util.GetColors().GetRange(0, 2), }; dataSets.Add(dataSetItem); var chartConfig = new ChartConfiguration { Type = ChartType.funnel.GetChartType(), Data = { Labels = new List <string> { "Open", "Closed", "Resolved" }, Datasets = dataSets }, Options = { Sort = "desc", Title = { Text = "My Test Chart" }, } }; return(chartConfig); }
private ChartConfiguration CreateServerConfiguration() { var dataSets = new List <DataSetItem>(); DataSetItem dataSetItem = new DataSetItem() { Label = "Issues", Data = new List <int?> { 288, 1493, 305, 27, 5, 174, 86, 72, 20 }, BackgroundColor = LibChart.Util.GetColors(), }; dataSets.Add(dataSetItem); var chartConfig = new ChartConfiguration { Type = ChartType.pie.GetChartType(), Data = { Labels = new List <string> { "Open", "Closed", "Resolved", "Reopened", "Pending", "Not A Bug", "Can't Replicate", "Discuss", "Fix in next Release" }, Datasets = dataSets }, Options = { Title = { Text = "My Test Chart" }, } }; return(chartConfig); }
private ChartConfiguration CreateServerConfiguration( int monitorCommandId, FrequencyTypes frequency, int agentGroupId) { var charts = (new MonitorDb()).GetChart( monitorCommandId, frequency, agentGroupId); //var unitStr = GetUnitString(frequency); if ((charts?.Count ?? 0) == 0) { lblEmptyData.Visible = true; return(null); } var dataSets = new List <DataSetItem>(); try { for (int i = 0; i < charts.Count; i++) { var chart = charts[i]; var colorCount = LibChart.Util.GetColors().Count; var dataSetItem = new DataSetItem() { Label = chart.AgentName, Data = chart.ReverseChartPointValues, BorderWidth = 1, BackgroundColor = LibChart.Util.GetColors(i % colorCount), BorderColor = LibChart.Util.GetColors()[i % colorCount], Fill = false }; dataSets.Add(dataSetItem); } var unit = _monitorCommands .Find(x => x.MonitorCommandId == monitorCommandId).Unit; var xAxesCallback = GetxAxesCallback(frequency); var units = GetMaxUnits(frequency); var xAxesTicks = new Ticks() { Display = true, BeginAtZero = true, Max = units, MaxTicksLimit = 12, Callback = (new JRaw(xAxesCallback)) }; var xAxesTicksItem = new TicksItem() { ticks = xAxesTicks }; var yAxesCallback = $@"function (value, index, values) {{ return value + ' {unit}'; }}"; var yAxesTicks = new Ticks() { Callback = new JRaw(yAxesCallback) }; var yAxesTicksItem = new TicksItem() { ticks = yAxesTicks }; var chartConfig = new ChartConfiguration { Type = ChartType.line.GetChartType(), Data = { Labels = charts[0] .ReverseChartPointMinutes .ConvertAll <string>(x => x.ToString()), Datasets = dataSets }, Options = { SpanGaps = true, Title = { Text = ddlMonitorCommands.SelectedItem.Text }, Scales = new Scales() { XAxes = new List <TicksItem>() { xAxesTicksItem }, YAxes = new List <TicksItem>() { yAxesTicksItem } } } }; return(chartConfig); } catch (Exception ex) { throw new Exception($"Exception:{ex.Message}"); } }
private ChartConfiguration CreateServerConfiguration(int monitorCommandId, FrequencyTypes frequency) { var charts = (new MonitorDb()).GetChart(monitorCommandId, frequency, -1); if ((charts?.Count ?? 0) == 0) { return(null); } var unit = _monitorCommands .Find(x => x.MonitorCommandId == monitorCommandId).Unit; var dataSets = new List <DataSetItem>(); for (var i = 0; i < charts.Count; i++) { var chart = charts[i]; var colorCount = LibChart.Util.GetColors().Count; var dataSetItem = new DataSetItem() { Label = chart.AgentName, Data = chart.ReverseChartPointValues, BorderWidth = 1, BackgroundColor = LibChart.Util.GetColors(i % colorCount), BorderColor = LibChart.Util.GetColors()[i % colorCount], Fill = false }; dataSets.Add(dataSetItem); } var xAxesCallback = @"function (value, index, values) { if (value > 0) { value = -1 * value;} return value + ' min'; }"; var xAxesTicks = new Ticks() { Display = true, BeginAtZero = true, Max = 24, MaxTicksLimit = 12, Callback = (new JRaw(xAxesCallback)) }; var xAxesTicksItem = new TicksItem() { ticks = xAxesTicks }; var yAxesCallback = $@"function (value, index, values) {{ return value + ' {unit}'; }}"; var yAxesTicks = new Ticks() { Callback = new JRaw(yAxesCallback) }; var yAxesTicksItem = new TicksItem() { ticks = yAxesTicks }; var chartConfig = new ChartConfiguration { Type = ChartType.line.GetChartType(), Data = { Labels = charts[0] .ChartPointMinutes .ConvertAll <string>(x => x.ToString()), Datasets = dataSets }, Options = { Title = { Text = ddlMonitorCommands.SelectedItem.Text }, Scales = new Scales() { XAxes = new List <TicksItem>() { xAxesTicksItem }, YAxes = new List <TicksItem>() { yAxesTicksItem } } } }; return(chartConfig); }
public Chart GetChart() { return(ChartConfiguration.Configure(TechnologicalConditionDTOs, TimeCharacteristicDTOs)); }
private ChartConfiguration CreateServerConfiguration() { var unit = "hrs"; var dataSets = new List <DataSetItem>(); DataSetItem dataSetItem = new DataSetItem() { Label = "Billable", Data = new List <int?> { 8, 1, 7, 5 }, BackgroundColor = new List <string>() { "red", "red", "red", "red" } }; dataSets.Add(dataSetItem); dataSetItem = new DataSetItem() { Label = "Non-Billable", Data = new List <int?> { 1, 3, 1, 5 }, BackgroundColor = new List <string>() { "green", "green", "green", "green" } }; dataSets.Add(dataSetItem); var chartConfig = new ChartConfiguration { Type = ChartType.bar.GetChartType(), Data = { Labels = new List <string> { "Jan 1", "Jan 2", "Jan 3", "Jan 4" }, Datasets = dataSets }, Options = { Title = { Text = "My Test Chart" }, Scales = new Scales() { XAxes = new List <AxesItem>() { new AxesItem() { stacked = true } }, YAxes = new List <AxesItem>() { new AxesItem() { stacked = true } } } } }; return(chartConfig); }
private ChartConfiguration CreateServerConfiguration() { var unit = "ms"; var dataSets = new List <DataSetItem>(); for (int i = 1; i <= 5; i++) { var dataSetItem = new DataSetItem() { Label = i.ToString(), Data = Util.CreateRandomInts(60, 230), BorderWidth = 1, BackgroundColor = LibChart.Util.GetColors(i % 5), BorderColor = LibChart.Util.GetColors(i % 5)[0], Fill = false }; dataSets.Add(dataSetItem); } var xAxesCallback = @"function (value, index, values) { if (value > 0) { value = -1 * value;} return value + ' min'; }"; var xAxesTicks = new Ticks() { Display = true, BeginAtZero = true, Max = 60, MaxTicksLimit = 12, Callback = (new JRaw(xAxesCallback)) }; var xAxesTicksItem = new AxesItem() { ticks = xAxesTicks }; var yAxesCallback = $@"function (value, index, values) {{ return value + ' {unit}'; }}"; var yAxesTicks = new Ticks() { Callback = new JRaw(yAxesCallback) }; var yAxesTicksItem = new AxesItem() { ticks = yAxesTicks }; var chartConfig = new ChartConfiguration { Type = ChartType.line.GetChartType(), Data = { Labels = Util.CreateLabels(1, 60), Datasets = dataSets }, Options = { Title = { Text = "My Test Chart" }, Scales = new Scales() { XAxes = new List <AxesItem>() { xAxesTicksItem }, YAxes = new List <AxesItem>() { yAxesTicksItem } } } }; return(chartConfig); }