public ActionResult TopPostCategories(ChartSize chartSize, TimePeriod timePeriod) { var dataSet = _analyticsService.GetTopPostCategories(DetermineTimePeriod(timePeriod)); var model = new ChartViewModel() { ChartId = string.Format("chart-top-post-categories-{0}", timePeriod.ToString().ToLower()), ChartName = string.Format("Top Post Categories ({0})", timePeriod.ToString()), ChartSize = chartSize, ChartType = ChartType.Pie, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel() { ColumnName = string.Format("{0} ({1})", item.Key, item.Value), ColumnValues = new List <int>() { item.Value } }); } return(PartialView("_DisplayChart", model)); }
public ActionResult TotalHitsMonthly(ChartSize chartSize) { var dataSet = _analyticsService.TotalHitsThisMonth(); var model = new ChartViewModel() { ChartId = "chart-total-hits-monthly", ChartName = "Total Hits Per Week This Month", ChartSize = chartSize, ChartType = ChartType.Bar, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel() { ColumnName = string.Format("{0}", item.Key), ColumnValues = new List <int>() { item.Value } }); } return(PartialView("_DisplayChart", model)); }
public LineChart(ChartSize size, ChartData data, AxisType axisTypes, AxisLabels labels, AxisRange ranges) : base(LineTypeDefinition, size, data) { _labels = labels; _axisType = axisTypes; _ranges = ranges; }
public LineChart(ChartSize size, ChartData data, AxisType axisTypes, AxisLabels labels, DataScale dataScale) : base(LineTypeDefinition, size, data) { _labels = labels; _axisType = axisTypes; _dataScale = dataScale; }
public async Task <ActionResult> ErrorPercentage(string chartName, ChartSize chartSize, DateTime sinceDate) { var dataSet = await _analyticsService.ErrorPercentageAsync(sinceDate); var model = new ChartViewModel { ChartId = $"chart-error-percentage-{sinceDate.ToString("yyyyMMhhhddmm")}", ChartName = chartName, ChartSize = chartSize, ChartType = ChartType.Pie, ChartColumns = new List <ColumnViewModel>(), ChartLink = new ChartLinkViewModel { LinkText = "More Details", LinkRoute = Url.Action(nameof(LogEntries), "AnalyticManager") } }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel { ColumnName = $"{item.Key} ({item.Value})", ColumnValues = new List <int> { item.Value } }); } return(PartialView(DISPLAY_CHART_VIEW, model)); }
/// <summary> /// Initializes a new instance of the <see cref="QRCodes"/> class. /// </summary> /// <param name="size">The chart size.</param> /// <param name="text">The text to encode.</param> /// <param name="encodingType">Type of the encoding.</param> public QRCodes(ChartSize size, string text, EncodingType encodingType) : base(QRCodeType, size) { _data = new PlainParam("chl", HttpUtility.UrlPathEncode(text)); // to reduce url length - do not add default encoding parameter if (DefaultEncoding != encodingType) { _encoding = new EncodingTypeParam(encodingType); } }
private async Task <byte[]> GetChart(ChartSize size, ChartType type, string username, string span, bool caption) { var imageDictionary = await GetAlbumArt(size, type, username, span, caption); if (imageDictionary == null) { return(null); } var result = await BuildChart(imageDictionary, (int)size, caption); return(result); }
/// <summary> /// 开始绘制开挖剖面图的Chart对象 /// </summary> /// <returns>进行绘图的Chart对象的高度值,以磅为单位,可以用来确定Excel Application的高度值</returns> /// <remarks>绘图时,标高值与Excel中的Y坐标值的对应关系: /// 在程序中,定义了eleTop变量(以米为单位)与F_sngTopRef变量(以磅为单位), /// 它们指示的是此基坑区域中,地下室顶板的标高值与其在Excel绘图中对应的Y坐标值</remarks> private Microsoft.Office.Interop.Excel.Chart DrawChart(Microsoft.Office.Interop.Excel.Worksheet DrawingSheet, List <clsData_ProcessRegionData> SelectedRegion) { Microsoft.Office.Interop.Excel.Application DrawingApp = DrawingSheet.Application; DrawingApp.ScreenUpdating = false; DrawingApp.Caption = "开挖标高图"; //---------------- 创建一个新的,进行绘图的Chart对象 ------------------------------- Excel.Chart DrawingChart = default(Excel.Chart); DrawingChart = DrawingSheet.Shapes.AddChart(Top: 0, Left: 0).Chart; string TemplatePath = System.IO.Path.Combine(System.Convert.ToString(My.Settings.Default.Path_Template), Constants.FolderOrFileName.File_Template.Chart_Elevation); DrawingChart.Parent.Activate(); DrawingChart.ApplyChartTemplate(TemplatePath); this.F_Textbox_Info = DrawingChart.Shapes.Item(1).TextFrame2; DrawingChart.ChartTitle.Text = "开挖标高图"; // Microsoft.Office.Interop.Excel.SeriesCollection src = DrawingChart.SeriesCollection(); for (short i = 0; i <= 1 - src.Count; i++) //确保Chart中至少有两个数据系列 { src.NewSeries(); } // ----------------------- 设置绘图及Excel窗口的尺寸 ---------------------------- double ChartHeight = 400; double InsideLeft = 60; double InsideRight = 20; double LeastWidth_Chart = 500; double LeastWidth_Column = 100; // double ChartWidth = LeastWidth_Chart; double insideWidth = LeastWidth_Chart - InsideLeft - InsideRight; // ChartWidth = GetChartWidth(DrawingChart, SelectedRegion.Count, LeastWidth_Chart, LeastWidth_Column, InsideLeft + InsideRight, ref insideWidth); ChartSize Size_Chart_App = new ChartSize(ChartHeight, ChartWidth, 26, 9); ExcelFunction.SetLocation_Size(Size_Chart_App, DrawingChart, DrawingChart.Application, true); //With DrawingChart.PlotArea // .InsideLeft = InsideLeft // .InsideWidth = insideWidth //End With // -------------------------------------------------- return(DrawingChart); }
public async Task Top( [Summary("The type of the chart. Either albums or artists.")] ChartType type, [Summary("The time span for the chart. Overall, year, 6month, 3month, month or week.")] string span, [OverrideTypeReader(typeof(ChartSizeReader))][Summary("Chart size. Supported sizes are 3x3, 4x4 and 5x5.")] ChartSize size, [Summary( "Pass this argument if you want to include names next to your chart. Accepted values are `-c` and `-t`. Currently there is no difference between them.")] string caption = "") { if (!await Preconditions.Preconditions.InChartposting(Context)) { return; } var user = await FindUserAsync(); if (user.LastFm == null) { await Error("You'll need to link your last.fm profile first."); } caption = caption.ToLowerInvariant(); var withCaption = caption == "captions" || caption == "-c" || caption == "-t" || caption == "titles"; var result = await chartService.GetChartAsync(size, type, user.LastFm, span, withCaption); if (result == null) { await Error( "Something went wrong obtaining the chart information. Check the given parameters and try again"); return; } using (Stream stream = new MemoryStream(result)) { await Context.Channel.SendFileAsync( stream, $"{Context.User.Username}_top_{type}_{size}.png", $"Top {type.ToString().ToLowerInvariant()} for {Context.User.Username}:"); } }
/// <summary> /// Clones this instance. /// </summary> /// <returns> /// A new object that is a copy of this instance. /// </returns> public XlsxMiniChartOptions Clone() { var cloned = (XlsxMiniChartOptions)MemberwiseClone(); if (ChartAxes != null) { cloned.ChartAxes = ChartAxes.Clone(); } if (ChartSize != null) { cloned.ChartSize = ChartSize.Clone(); } //if (ChartType != null) //{ // cloned.ChartType = ChartType.Clone(); //} return(cloned); }
public ActionResult TopPosts(ChartSize chartSize, TimePeriod timePeriod) { var dataSet = _analyticsService.GetTopPosts(DetermineTimePeriod(timePeriod)); var model = new ChartViewModel { ChartId = $"chart-top-posts-{timePeriod.ToString().ToLower()}", ChartName = $"Top Posts ({timePeriod.ToString()})", ChartSize = chartSize, ChartType = ChartType.Pie, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel { ColumnName = $"{item.Key} ({item.Value})", ColumnValues = new List <int> { item.Value } }); } return(PartialView(DISPLAY_CHART_VIEW, model)); }
public ActionResult TotalHitsWeekly(ChartSize chartSize) { var dataSet = _analyticsService.TotalHitsThisWeek(); var model = new ChartViewModel { ChartId = "chart-total-hits-weekly", ChartName = "Total Hits This Week", ChartSize = chartSize, ChartType = ChartType.Bar, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel { ColumnName = $"{item.Key})", ColumnValues = new List <int> { item.Value } }); } return(PartialView(DISPLAY_CHART_VIEW, model)); }
public async Task <ActionResult> TopPostCategories(ChartSize chartSize, TimePeriod timePeriod) { var dataSet = await _analyticsService.GetTopPostCategoriesAsync(DetermineTimePeriod(timePeriod)); var model = new ChartViewModel { ChartId = $"chart-top-post-categories-{timePeriod.ToString().ToLower()}", ChartName = $"Top Post Categories ({timePeriod.ToString()})", ChartSize = chartSize, ChartType = ChartType.Pie, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel { ColumnName = $"{item.Key} ({item.Value})", ColumnValues = new List <int> { item.Value } }); } return(PartialView("_DisplayChart", model)); }
public async Task <ActionResult> TotalHitsToday(ChartSize chartSize) { var dataSet = await _analyticsService.TotalHitsTodayAsync(); var model = new ChartViewModel { ChartId = "chart-total-hits-today", ChartName = "Total Hits Today", ChartSize = chartSize, ChartType = ChartType.Donut, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel { ColumnName = $"{item.Key} ({item.Value})", ColumnValues = new List <int> { item.Value } }); } return(PartialView(DISPLAY_CHART_VIEW, model)); }
public async Task <ActionResult> TotalHitsMonthly(ChartSize chartSize) { var dataSet = await _analyticsService.TotalHitsThisMonthAsync(); var model = new ChartViewModel { ChartId = "chart-total-hits-monthly", ChartName = "Total Hits Per Week This Month", ChartSize = chartSize, ChartType = ChartType.Bar, ChartColumns = new List <ColumnViewModel>() }; foreach (var item in dataSet) { model.ChartColumns.Add(new ColumnViewModel { ColumnName = $"{item.Key}", ColumnValues = new List <int> { item.Value } }); } return(PartialView("_DisplayChart", model)); }
/// <summary> /// Constructor /// </summary> /// <param name="type">Type of the chart</param> /// <param name="size">Size of the chart</param> /// <param name="data">Chart data</param> public Chart(ChartType type, ChartSize size, ChartData data) : base(type, size) { _data = data; }
/// <summary> /// Initializes a new instance of the <see cref="QRCodes"/> class. /// </summary> /// <param name="size">The chart size.</param> /// <param name="text">The text to encode.</param> /// <param name="encodingType">Type of the encoding.</param> /// <param name="errorCorrection">Error correction level</param> /// <param name="margin">Margin</param> public QRCodes(ChartSize size, string text, EncodingType encodingType, ErrorCorrectionLevel errorCorrection, int margin) : this(size, text, encodingType) { if ((errorCorrection != DefaultErrorCorrectionLevel) && (margin != DefaultMargin)) { _options = new QROptions(errorCorrection, margin); } }
public async Task <byte[]> GetChartAsync(ChartSize size, ChartType type, string username, string span, bool caption) => await GetChart(size, type, username, span, caption);
/// <summary> /// Initializes a new instance of the <see cref="QRCodes"/> class. /// </summary> /// <param name="size">The chart size.</param> /// <param name="text">The text to encode.</param> public QRCodes(ChartSize size, string text) : this(size, text, DefaultEncoding) { }
/// <summary> /// Initializes a new instance of the <see cref="LineChart"/> class. /// </summary> /// <param name="size">The chart size.</param> /// <param name="data">The chart data.</param> public LineChart(ChartSize size, ChartData data) : base(LineTypeDefinition, size, data) { }