public bool AddChart(ChartType chartType, int upperLeftRow, int upperLeftColumn, int lowerRightRow, int lowerRightColumn) { try { //build URI to get page count string strURI = Product.BaseProductUri + "/cells/" + FileName; strURI += "/worksheets/" + WorksheetName + "/charts?chartType=" + chartType + "&upperLeftRow=" + upperLeftRow + "&upperLeftColumn=" + upperLeftColumn + "&lowerRightRow=" + lowerRightRow + "&lowerRightColumn=" + lowerRightColumn; string signedURI = Utils.Sign(strURI); StreamReader reader = new StreamReader(Utils.ProcessCommand(signedURI, "PUT")); //further process JSON response string strJSON = reader.ReadToEnd(); //Parse the json string to JObject JObject parsedJSON = JObject.Parse(strJSON); BaseResponse baseResponse = JsonConvert.DeserializeObject<BaseResponse>(parsedJSON.ToString()); if (baseResponse.Code == "200" && baseResponse.Status == "OK") return true; else return false; } catch (Exception ex) { throw new Exception(ex.Message); } }
private void UpdateData(ChartType ct) { string stylename = "sstyle"; if (ct == ChartType.Ribbon || ct.ToString().Contains("3D")) { stylename = "sstyle3d"; chart.Actions.Add(new Rotate3DAction()); } chart.BeginUpdate(); // use appropriate sample data if (ct == ChartType.HighLowOpenClose || ct == ChartType.Candle) chart.Data = data.FinancialData; else if (ct == ChartType.Bubble) chart.Data = data.BubbleData; else if (ct == ChartType.Gantt) chart.Data = data.GanttData; else chart.Data = data.DefaultData; // set style of plot elements foreach (DataSeries ds in chart.Data.Children) { ds.SymbolStyle = FindResource(stylename) as Style; ds.ConnectionStyle = FindResource(stylename) as Style; ds.PointTooltipTemplate = FindResource("lbl") as DataTemplate; } chart.EndUpdate(); }
public ChartClickedEventArgs(string columnName_, string rowName_, double value_, ChartType ctype_) { ChartType = ctype_; ColumnName = columnName_; RowName = rowName_; Value = value_; }
public static void ReportExcelToImage(String filePath, String[] columnList,String title,ChartType chartType=ChartType.COLUMN) { FileInfo file = new FileInfo(filePath); String directory=""; if (Constant.ANALYZE_CHART_DIR.Equals("")) { directory = file.DirectoryName; } else { directory = Constant.ANALYZE_CHART_DIR; } String fileName = file.Name.Substring(0,file.Name.IndexOf('.')); String imagePath = directory + @"\" + fileName +"-" +title + ".jpg"; Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Open(filePath); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Excel.Range chartRange; Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing); Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 1000, 850); Excel.Chart chartPage = myChart.Chart; //non-empty count of csv file int count = Convert.ToInt32(xlApp.WorksheetFunction.CountA(xlWorkSheet.get_Range("A:A"))); //non-empty count of header int headerCount = Convert.ToInt32(xlApp.WorksheetFunction.CountA(xlWorkSheet.Rows[1])); string chartString="A1:A"+count; foreach (var column in columnList) { int columnIndex = GetColumnIndex(xlWorkSheet, headerCount, column); chartString += "," + GetString(columnIndex) + "1:" + GetString(columnIndex) + count; } chartRange = xlWorkSheet.get_Range(chartString); chartPage.SetSourceData(chartRange, misValue); //chartPage.ChartType = Excel.XlChartType.xlColumnClustered; chartPage.ChartType = GetChartType(chartType); chartPage.Axes(Excel.XlAxisType.xlValue); //export chart as picture file chartPage.Export(imagePath, "JPG", misValue); xlWorkBook.Close(false, misValue, misValue); xlApp.Quit(); releaseObject(xlWorkSheet); releaseObject(xlWorkBook); releaseObject(xlApp); }
// GET: Formulas/Create public ActionResult Create() { ViewBag.Sidebar = true; ViewBag.ActiveSidebar = "Formulas"; ViewBag.LinkedFormulaID = new SelectList(db.Formulas, "FormulaID", "Name"); ChartType chartTypes = new ChartType(); ViewBag.ChartType = chartTypes.ToSelectList(); UnitEnum unitEnum = new UnitEnum(); ViewBag.Unit = unitEnum.ToSelectList(); return View(); }
public void Generate(BudgetDTO[] budget, Int32 money) { Chart = new ChartType() { Type = "areaspline" }; Title = new Title() { Text = "Budget report" }; Subtitle = new Title() { Text = "Current session" }; XAxis = new XAxis() { Categories = budget.Select(x => x.Name).ToArray() }; YAxis = new YAxis() { Title = new Title() { Text = "Budget" } }; Tooltip = new Tooltip() { Shared = true, ValueSuffix = " money" }; Series = new ChartSeries[] { new ChartSeries() { Name = "Current", Data = budget.Select(x => (Int32)(x.Value)).ToArray() } }; }
private static Excel.XlChartType GetChartType(ChartType type) { if (type == ChartType.LINE) { return Excel.XlChartType.xlLine; } if (type == ChartType.COLUMN) { return Excel.XlChartType.xlColumnClustered; } return Excel.XlChartType.xlColumnClustered; }
internal ChartQuotation(ChartType chartType, DateTime dateTime, Guid instrumentId, Guid quotePolicyId, decimal open, decimal close, decimal high, decimal low, double volume) { this._ChartType = chartType; this.DateTime = dateTime; this._InstrumentId = instrumentId; this._QuotePolicyId = quotePolicyId; this._Open = open; this._Close = close; this._High = high; this._Low = low; this._Volume = volume; }
public Chart(ChartType type, ChartModel model) { _model = model; _type = type; // Initialize the default values _initDefaultValues(); System.IO.Stream s = this.GetType().Assembly.GetManifestResourceStream("FreeSilverlightChart.Chart.xaml"); _chartCanvas = XamlReader.Load(new System.IO.StreamReader(s).ReadToEnd()) as Canvas; _timer = _chartCanvas.FindName("timer") as Storyboard; this.Children.Add(_chartCanvas); }
public DataChart() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); BackColor = Color.Silver; _colorLine = Color.DarkBlue; _colorGrid = Color.Yellow; _yMaxInit = 1000; _gridPixel = 0; _chartType = ChartType.Stick; _arrayList = new ArrayList(); }
/// <summary> /// Creates a spreadsheet document with a chart from a value table /// </summary> /// <param name="filePath">Path to store the document</param> /// <param name="headerList">Contents of first row (header)</param> /// <param name="valueTable">Contents of data</param> /// <param name="chartType">Chart type</param> /// <param name="categoryColumn">Column to use as category for charting</param> /// <param name="columnsToChart">Columns to use as data series</param> /// <param name="initialRow">Row index to start copying data</param> /// <returns>SpreadsheetDocument</returns> public static void Create(SpreadsheetDocument document, List<string> headerList, string[][] valueTable, ChartType chartType, string categoryColumn, List<string> columnsToChart, int initialRow) { headerRow = initialRow; //Creates worksheet with data WorksheetPart worksheet = WorksheetAccessor.Create(document, headerList, valueTable, headerRow); //Creates chartsheet with given series and category string sheetName = GetSheetName(worksheet, document); ChartsheetPart chartsheet = ChartsheetAccessor.Create(document, chartType, GetValueReferences(sheetName, categoryColumn, headerList, columnsToChart, valueTable), GetHeaderReferences(sheetName, categoryColumn, headerList, columnsToChart, valueTable), GetCategoryReference(sheetName, categoryColumn, headerList, valueTable) ); }
void SetChartType(ChartType type) { imageStats.Src = string.Format("SystemStatsChart.aspx?type={0}&CacheDuration=300", type); switch (type) { case ChartType.DailyNew: labelChartType.Text = "New Visitors"; break; case ChartType.DailyReturning: labelChartType.Text = "Returning Visitors"; break; case ChartType.MonthlyUnique: labelChartType.Text = "Monthly Unique"; break; case ChartType.AccountDaily: case ChartType.AccountMonthly: case ChartType.AccountWeekly: case ChartType.AccountYearly: labelChartType.Text = type.ToString().Replace("Account", "New Accounts "); break; default: labelChartType.Text = type.ToString(); break; } linkDaily.Enabled = (type != ChartType.Daily); linkHourly.Enabled = (type != ChartType.Hourly); linkMonthly.Enabled = (type != ChartType.Monthly); linkYearly.Enabled = (type != ChartType.Yearly); linkWeekly.Enabled = (type != ChartType.Weekly); linkAccountDaily.Enabled = (type != ChartType.AccountDaily); linkAccountMonthly.Enabled = (type != ChartType.AccountMonthly); linkAccountYearly.Enabled = (type != ChartType.AccountYearly); linkAccountWeekly.Enabled = (type != ChartType.AccountWeekly); linkDailyNew.Enabled = (type != ChartType.DailyNew); linkDailyReturning.Enabled = (type != ChartType.DailyReturning); linkMonthlyUnique.Enabled = (type != ChartType.MonthlyUnique); }
private void DrawChart(ChartType chartType) { string url; switch (chartType) { case ChartType.TimeSheet0://http://hqpicr.dfcfw.com/r/0026492.png?0.6290230534505099 url = string.Format("http://hqpicr.dfcfw.com/r/{0}{1}.png", stockCode.Substring(2, stockCode.Length - 2), GetStockType(stockCode)); picTimeSheet0Trans.ImageLocation = url; picTimeSheet0Trans.Refresh(); break; case ChartType.TimeSheet: url = string.Format("http://image.sinajs.cn/newchart/min/n/{0}.gif", stockCode); picTimeSheetTrans.ImageLocation = url; picTimeSheetTrans.Refresh(); break; case ChartType.KOfDay://http://image.sinajs.cn/newchart/daily/n/{0}.gif url = string.Format("http://hqpick.eastmoney.com/EM_Quote2010PictureProducter/Index.aspx?ImageType=KXL&ID={0}{1}&EF=&Formula=MACD&UnitWidth=6&StockFQ=0&type=", stockCode.Substring(2, stockCode.Length - 2), GetStockType(stockCode)); picDayTrans.ImageLocation = url; picDayTrans.Refresh(); break; case ChartType.KOfWeek: url = string.Format("http://image.sinajs.cn/newchart/weekly/n/{0}.gif", stockCode); picWeekTrans.ImageLocation = url; picWeekTrans.Refresh(); break; case ChartType.KOfMonth: url = string.Format("http://image.sinajs.cn/newchart/monthly/n/{0}.gif", stockCode); picMonthTrans.ImageLocation = url; picMonthTrans.Refresh(); break; case ChartType.Comprehensive: if (this.webBrowser1.Url == null) this.webBrowser1.Url = new Uri(string.Format("http://i2.sinaimg.cn/cj/hsuan/flash/SinaKLine207a.swf?symbol={0}", stockCode)); break; default: MessageBox.Show("不支持该分析图"); break; } }
public Chart(string name, ChartType type = ChartType.Overlay) { Name = name; Series = new Dictionary <string, Series>(); ChartType = type; }
private void btnBar_Click(object sender, EventArgs e) { chartType = ChartType.Bar; drawChart(BaseDataTable.Data, chartType, xlog.Checked, ylog.Checked); }
/// <summary> /// Adds a new chart with the specified type to the text frame. /// </summary> public Chart AddChart(ChartType _type) { return(this.Elements.AddChart(_type)); }
public HorizontalBarChart(ChartType type, ChartModel model) : base(type, model) { }
/// <summary> /// /// </summary> /// <param name="sld">当前ppt页面</param> /// <param name="dt">数据</param> /// <param name="index">图表所属表格排序(当前slide)</param> public static void DoubleAxexchart(ISlide sld, System.Data.DataTable dt, int index, ChartType type) { IChart t1 = (IChart)sld.Shapes[index]; string range = "Sheet1!$A$1:$" + Base_ColumnsHelper.GET_INDEX(dt.Columns.Count + 1) + "$" + (dt.Rows.Count + 1); //实例化图表数据表 IChartDataWorkbook fact = t1.ChartData.ChartDataWorkbook; t1.Axes.SecondaryVerticalAxis.IsAutomaticMajorUnit = true; t1.Axes.SecondaryVerticalAxis.IsAutomaticMaxValue = true; t1.Axes.SecondaryVerticalAxis.IsAutomaticMinorUnit = true; t1.Axes.SecondaryVerticalAxis.IsAutomaticMinValue = true; t1.ChartData.ChartDataWorkbook.Clear(0); Workbook workbook = Office_TableToWork.GetWorkBooxFromDataTable(dt); MemoryStream mem = new MemoryStream(); workbook.Save(mem, Aspose.Cells.SaveFormat.Xlsx); t1.ChartData.WriteWorkbookStream(mem); t1.ChartData.SetRange(range); IChartSeries series = t1.ChartData.Series[0]; series.Type = t1.Chart.Type; series.Labels.DefaultDataLabelFormat.ShowValue = true; series.Labels.DefaultDataLabelFormat.Position = LegendDataLabelPosition.Center; series.Labels.DefaultDataLabelFormat.TextFormat.TextBlockFormat.TextVerticalType = TextVerticalType.Vertical270; ////设置第二个系列表 IChartSeries series1 = t1.ChartData.Series[2]; series1.PlotOnSecondAxis = true; series1.Type = ChartType.StackedLineWithMarkers; series1.Labels.DefaultDataLabelFormat.ShowValue = true; series1.Labels.DefaultDataLabelFormat.Position = LegendDataLabelPosition.Top; series1.Labels.DefaultDataLabelFormat.TextFormat.TextBlockFormat.TextVerticalType = TextVerticalType.Vertical270; }
/// <summary> /// 更新图表方法 /// </summary> public async Task Update(string method = "") { if (OnInit != null) { var ds = await OnInit.Invoke(); if (Interop != null) { await Interop.InvokeVoidAsync(this, ChartElement, "chart", nameof(Completed), ds, method, ChartType.ToDescriptionString(), Angle); } } }
internal static ChartQuotation Create(ChartType chartType, DataRow row) { return new ChartQuotation(chartType, (DateTime)row["Date"], (Guid)row["InstrumentId"], (Guid)row["QuotePolicyId"], (decimal)row["Open"], (decimal)row["Close"], (decimal)row["High"], (decimal)row["Low"], row["Volume"] == DBNull.Value ? 0 : (double)row["Volume"]); }
public static Chart CreateChart(ChartType type, ChartModel model) { Chart chart = null; if (type == ChartType.VBAR || type == ChartType.VBAR_STACKED || type == ChartType.BAR_LINE_COMBO || type == ChartType.BAR_AREA_COMBO || type == ChartType.BAR_LINE_AREA_COMBO) { chart = new BarChart(type, model); } else if (type == ChartType.HBAR || type == ChartType.HBAR_STACKED) { chart = new HorizontalBarChart(type, model); } else if( type == ChartType.CYLINDERBAR) { chart = new CylinderBarChart(type, model); } else if (type == ChartType.PIE) { chart = new PieChart(type, model); } else if (type == ChartType.AREA || type == ChartType.AREA_STACKED) { chart = new AreaChart(type, model); } else if (type == ChartType.LINE) { chart = new LineChart(type, model); } else if (type == ChartType.SCATTER_PLOT) { chart = new ScatterPlotChart(type, model); } else if (type == ChartType.XYLINE) { chart = new XYLineChart(type, model); } else if (type == ChartType.RADAR || type == ChartType.RADAR_AREA) { chart = new RadarChart(type, model); } else if (type == ChartType.FUNNEL) { chart = new FunnelChart(type, model); } else if (type == ChartType.SEMI_CIRCULAR_GAUGE) { chart = new SemiCircularGaugeChart(type, model); } else if (type == ChartType.CIRCULAR_GAUGE) { chart = new GaugeChart(type, model); } else if (type == ChartType.CANDLE_STICK) { chart = new CandleStickChart(type, model); } return chart; }
/// <summary> /// Add a sample to the chart specified by the chartName, and seriesName. /// </summary> /// <param name="chartName">String chart name to place the sample.</param> /// <param name="chartType">Type of chart we should create if it doesn't already exist.</param> /// <param name="seriesName">Series name for the chart.</param> /// <param name="seriesType">Series type for the chart.</param> /// <param name="time">Time for the sample</param> /// <param name="value">Value for the chart sample.</param> /// <param name="unit">Unit for the sample axis</param> /// <remarks>Sample can be used to create new charts or sample equity - daily performance.</remarks> public void Sample(string chartName, ChartType chartType, string seriesName, SeriesType seriesType, DateTime time, decimal value, string unit = "$") { var chartFilename = Path.Combine(_chartDirectory, chartName + "-" + seriesName + ".csv"); lock (_chartLock) { // Add line to list in dictionary, will be written to file at the end List<string> rows; if (!_equityResults.TryGetValue(chartFilename, out rows)) { rows = new List<string>(); _equityResults[chartFilename] = rows; } rows.Add(time + "," + value.ToString("F2", CultureInfo.InvariantCulture)); //Add a copy locally: if (!Charts.ContainsKey(chartName)) { Charts.AddOrUpdate<string, Chart>(chartName, new Chart(chartName, chartType)); } //Add the sample to our chart: if (!Charts[chartName].Series.ContainsKey(seriesName)) { Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType)); } //Add our value: Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value)); } }
public Series Type(ChartType type) { this.type = type; return this; }
public Chart(string name, ChartType type = ChartType.Overlay) { Name = name; Series = new Dictionary<string, Series>(); ChartType = type; }
internal static string InvalidChartTypeForCombination(ChartType chartType) { return string.Format("ChartType '{0}' not valid for combination of charts.", chartType.ToString()); }
/// <summary> /// Creates a new instance of <see cref="BubbleDataset"/> with /// a custom <see cref="ChartType"/>. Use this constructor when /// you implement a bubble-like chart. /// </summary> /// <param name="type">The <see cref="ChartType"/> to use instead of <see cref="ChartType.Bubble"/>.</param> protected BubbleDataset(ChartType type) : base(type) { }
private void DrawLabels(Rect chartPosition, ChartViewData data, int selectedFrame, ChartType chartType) { if (data.selectedLabels == null || Event.current.type != EventType.Repaint) { return; } // exit early if the selected frame is outside the domain of the chart var domain = data.GetDataDomain(); if ( selectedFrame < data.firstSelectableFrame || selectedFrame > data.chartDomainOffset + (int)(domain.y - domain.x) || domain.y - domain.x == 0f ) { return; } var selectedIndex = selectedFrame - data.chartDomainOffset; m_LabelOrder.Clear(); m_LabelOrder.AddRange(data.order); // get values of all series and cumulative value of all enabled stacks m_SelectedFrameValues.Clear(); var stacked = chartType == ChartType.StackedFill; var numLabels = 0; for (int s = 0; s < data.numSeries; ++s) { var chartData = data.hasOverlay ? data.overlays[s] : data.series[s]; var value = chartData.yValues[selectedIndex] * chartData.yScale; m_SelectedFrameValues.Add(value); if (data.series[s].enabled) { ++numLabels; } } if (numLabels == 0) { return; } // populate layout data array with default data m_LabelData.Clear(); var selectedFrameMidline = chartPosition.x + chartPosition.width * ((selectedIndex + 0.5f) / (domain.y - domain.x)); var maxLabelWidth = 0f; numLabels = 0; for (int s = 0; s < data.numSeries; ++s) { var labelData = new LabelLayoutData(); var chartData = data.series[s]; var value = m_SelectedFrameValues[s]; if (chartData.enabled && value >= labelRange.x && value <= labelRange.y) { var rangeAxis = chartData.rangeAxis; var rangeSize = rangeAxis.sqrMagnitude == 0f ? 1f : rangeAxis.y * chartData.yScale - rangeAxis.x; // convert stacked series to cumulative value of enabled series if (stacked) { var accumulatedValues = 0f; int currentChartIndex = m_LabelOrder.FindIndex(x => x == s); for (int i = currentChartIndex - 1; i >= 0; --i) { var otherSeriesIdx = data.order[i]; var otherChartData = data.hasOverlay ? data.overlays[otherSeriesIdx] : data.series[otherSeriesIdx]; bool enabled = data.series[otherSeriesIdx].enabled; if (enabled) { accumulatedValues += otherChartData.yValues[selectedIndex] * otherChartData.yScale; } } // labels for stacked series will be in the middle of their stacks value = accumulatedValues + (0.5f * value); } // default position is left aligned to midline var position = new Vector2( // offset by half a point so there is a 1-point gap down the midline if labels are on both sides selectedFrameMidline + 0.5f, chartPosition.y + chartPosition.height * (1.0f - ((value * chartData.yScale - rangeAxis.x) / rangeSize)) ); var size = Styles.whiteLabel.CalcSize(EditorGUIUtility.TempContent(data.selectedLabels[s])); position.y -= 0.5f * size.y; position.y = Mathf.Clamp(position.y, chartPosition.yMin, chartPosition.yMax - size.y); labelData.position = new Rect(position, size); labelData.desiredYPosition = labelData.position.center.y; ++numLabels; } m_LabelData.Add(labelData); maxLabelWidth = Mathf.Max(maxLabelWidth, labelData.position.width); } if (numLabels == 0) { return; } // line charts order labels based on series values if (!stacked) { m_LabelOrder.Sort(SortLineLabelIndices); } // right align labels to the selected frame midline if approaching right border if (selectedFrameMidline > chartPosition.x + chartPosition.width - maxLabelWidth) { for (int s = 0; s < data.numSeries; ++s) { var label = m_LabelData[s]; label.position.x -= label.position.width; m_LabelData[s] = label; } } // alternate right/left alignment if in the middle else if (selectedFrameMidline > chartPosition.x + maxLabelWidth) { var processed = 0; for (int s = 0; s < data.numSeries; ++s) { var labelIndex = m_LabelOrder[s]; if (m_LabelData[labelIndex].position.size.sqrMagnitude == 0f) { continue; } if ((processed & 1) == 0) { var label = m_LabelData[labelIndex]; // ensure there is a 1-point gap down the midline label.position.x -= label.position.width + 1f; m_LabelData[labelIndex] = label; } ++processed; } } // separate overlapping labels for (int it = 0; it < k_LabelLayoutMaxIterations; ++it) { m_MostOverlappingLabels.Clear(); // work on the biggest cluster of overlapping rects for (int s1 = 0; s1 < data.numSeries; ++s1) { m_OverlappingLabels.Clear(); m_OverlappingLabels.Add(s1); if (m_LabelData[s1].position.size.sqrMagnitude == 0f) { continue; } for (int s2 = 0; s2 < data.numSeries; ++s2) { if (m_LabelData[s2].position.size.sqrMagnitude == 0f) { continue; } if (s1 != s2 && m_LabelData[s1].position.Overlaps(m_LabelData[s2].position)) { m_OverlappingLabels.Add(s2); } } if (m_OverlappingLabels.Count > m_MostOverlappingLabels.Count) { m_MostOverlappingLabels.Clear(); m_MostOverlappingLabels.AddRange(m_OverlappingLabels); } } // finish if there are no more overlapping rects if (m_MostOverlappingLabels.Count == 1) { break; } float totalHeight; var geometricCenter = GetGeometricCenter(m_MostOverlappingLabels, m_LabelData, out totalHeight); // account for other rects that will overlap after expanding var foundOverlaps = true; while (foundOverlaps) { foundOverlaps = false; var minY = geometricCenter - 0.5f * totalHeight; var maxY = geometricCenter + 0.5f * totalHeight; for (int s = 0; s < data.numSeries; ++s) { if (m_MostOverlappingLabels.Contains(s)) { continue; } var testRect = m_LabelData[s].position; if (testRect.size.sqrMagnitude == 0f) { continue; } var x = testRect.xMax < selectedFrameMidline ? testRect.xMax : testRect.xMin; if ( testRect.Contains(new Vector2(x, minY)) || testRect.Contains(new Vector2(x, maxY)) ) { m_MostOverlappingLabels.Add(s); foundOverlaps = true; } } GetGeometricCenter(m_MostOverlappingLabels, m_LabelData, out totalHeight); // keep labels inside chart rect if (geometricCenter - 0.5f * totalHeight < chartPosition.yMin) { geometricCenter = chartPosition.yMin + 0.5f * totalHeight; } else if (geometricCenter + 0.5f * totalHeight > chartPosition.yMax) { geometricCenter = chartPosition.yMax - 0.5f * totalHeight; } } // separate overlapping rects and distribute them away from their geometric center m_MostOverlappingLabels.Sort(SortOverlappingRectIndices); var heightAllotted = 0f; for (int i = 0; i < m_MostOverlappingLabels.Count; ++i) { var labelIndex = m_MostOverlappingLabels[i]; var label = m_LabelData[labelIndex]; label.position.y = geometricCenter - totalHeight * 0.5f + heightAllotted; m_LabelData[labelIndex] = label; heightAllotted += label.position.height; } } // draw the labels var oldContentColor = GUI.contentColor; for (int s = 0; s < data.numSeries; ++s) { var labelIndex = m_LabelOrder[s]; if (m_LabelData[labelIndex].position.size.sqrMagnitude == 0f) { continue; } GUI.contentColor = Color.Lerp(data.series[labelIndex].color, Color.white, Styles.labelLerpToWhiteAmount); var layoutData = m_LabelData[labelIndex]; EditorGUI.DoDropShadowLabel( layoutData.position, EditorGUIUtility.TempContent(data.selectedLabels[labelIndex]), Styles.whiteLabel, Styles.labelDropShadowOpacity ); } GUI.contentColor = oldContentColor; }
public override string ToString() { return(LocalizedResources.GetResString("Tools." + ChartType.ToString(), Name)); }
/// <summary> /// Creates a new instance of <see cref="ConfigBase"/> /// </summary> /// <param name="chartType">The chartType this config is for</param> protected ConfigBase(ChartType chartType) { Type = chartType; }
public AreaChart(ChartType type, ChartModel model) : base(type, model) { }
// TODO: clean this public static ValueTask <bool> SetChartData <TItem, TOptions>(IJSRuntime runtime, string id, ChartType type, ChartData <TItem> data, TOptions options, string dataJsonString, string optionsJsonString) { return(runtime.InvokeAsync <bool>("blazoriseCharts.setChartData", id, ToChartTypeString(type), ToChartDataSet(data), options, dataJsonString, optionsJsonString)); }
/// <summary> /// Initializes a new instance of the <see cref="ChartSettings" /> class. /// </summary> /// <param name="xAxisList">xAxisList.</param> /// <param name="yAxisList">yAxisList.</param> /// <param name="legendSourceList">legendSourceList.</param> /// <param name="legendEntriesList">legendEntriesList.</param> /// <param name="id">id.</param> /// <param name="title">title.</param> /// <param name="description">description.</param> /// <param name="dataSource">dataSource.</param> /// <param name="type">type.</param> /// <param name="xAxis">xAxis.</param> /// <param name="yAxis">yAxis.</param> /// <param name="enableLegend">enableLegend.</param> /// <param name="legendSource">legendSource.</param> /// <param name="legendEntries">legendEntries.</param> public ChartSettings(List <StringModel> xAxisList = default(List <StringModel>), List <StringModel> yAxisList = default(List <StringModel>), List <StringModel> legendSourceList = default(List <StringModel>), List <StringModel> legendEntriesList = default(List <StringModel>), Guid id = default(Guid), string title = default(string), string description = default(string), ReportDataSource dataSource = default(ReportDataSource), ChartType type = default(ChartType), string xAxis = default(string), string yAxis = default(string), bool enableLegend = default(bool), string legendSource = default(string), List <string> legendEntries = default(List <string>)) { this.XAxisList = xAxisList; this.YAxisList = yAxisList; this.LegendSourceList = legendSourceList; this.LegendEntriesList = legendEntriesList; this.Id = id; this.Title = title; this.Description = description; this.DataSource = dataSource; this.Type = type; this.XAxis = xAxis; this.YAxis = yAxis; this.EnableLegend = enableLegend; this.LegendSource = legendSource; this.LegendEntries = legendEntries; }
public static ValueTask Initialize <TItem, TOptions>(IJSRuntime runtime, DotNetObjectReference <ChartAdapter> dotNetObjectReference, bool hasClickEvent, bool hasHoverEvent, string canvasId, ChartType type, ChartData <TItem> data, TOptions options, string dataJsonString, string optionsJsonString, object optionsObject) { return(runtime.InvokeVoidAsync("blazoriseCharts.initialize", dotNetObjectReference, hasClickEvent, hasHoverEvent, canvasId, ToChartTypeString(type), ToChartDataSet(data), options, dataJsonString, optionsJsonString, optionsObject)); }
private void CreateSPDLToBLSlides(TaskGroupData taskData, int lowestSLideIndex, ref int createdCount, PresentationPart oPPart, ChartType chartType) { Repository.Utility.WriteLog("CreateLateSlides started", System.Diagnostics.EventLogEntryType.Information); try { #region LateSlides if (chartType == ChartType.SPBaseLineStart && SPDSSlidePart == null) return; if (chartType == ChartType.SPBaseLineFinish && SPDFSlidePart == null) return; if (chartType == ChartType.SPBEI && SPBEISlidePart == null) return; SlidePart chartSlidePart = oPPart.GetSlidePartsInOrder().ToList()[lowestSLideIndex + createdCount]; if (chartSlidePart.ChartParts.ToList().Count > 0) { var chartPart = chartSlidePart.ChartParts.ToList()[0]; foreach (IdPartPair part in chartPart.Parts) { var spreadsheet = chartPart.GetPartById(part.RelationshipId) as EmbeddedPackagePart; if (spreadsheet != null) { using (var oSDoc = SpreadsheetDocument.Open(spreadsheet.GetStream(FileMode.OpenOrCreate, FileAccess.ReadWrite), true)) { var workSheetPart = oSDoc.WorkbookPart.GetPartsOfType<WorksheetPart>().FirstOrDefault(); var sheetData = workSheetPart.Worksheet.Elements<SheetData>().FirstOrDefault(); switch (chartType) { case ChartType.SPBaseLineStart: if (taskData.SPDLSTartToBL != null && taskData.SPDLSTartToBL.Count > 0 && taskData.SPDLSTartToBL[0].Data != null) { WorkbookUtilities.ReplicateRow(sheetData, 2, taskData.SPDLSTartToBL[0].Data.Count - 1); WorkbookUtilities.LoadGraphSheetData(sheetData, taskData.SPDLSTartToBL, 1, 0); BarChartUtilities.LoadChartData(chartPart, taskData.SPDLSTartToBL); } break; case ChartType.SPBaseLineFinish: if (taskData.SPDLFinishToBL != null && taskData.SPDLFinishToBL.Count > 0 && taskData.SPDLFinishToBL[0].Data != null) { WorkbookUtilities.ReplicateRow(sheetData, 2, taskData.SPDLFinishToBL[0].Data.Count - 1); WorkbookUtilities.LoadGraphSheetData(sheetData, taskData.SPDLFinishToBL, 1, 0); BarChartUtilities.LoadChartData(chartPart, taskData.SPDLFinishToBL); } break; case ChartType.SPBEI: if (taskData.BEIData != null && taskData.BEIData.Count > 0 && taskData.BEIData[0].Data != null) { WorkbookUtilities.ReplicateRow(sheetData, 2, taskData.BEIData[0].Data.Count - 1); WorkbookUtilities.LoadGraphSheetData(sheetData, taskData.BEIData, 1, 0); BarChartUtilities.LoadChartData(chartPart, taskData.BEIData); } break; } } break; } } } #endregion } catch (Exception ex) { Repository.Utility.WriteLog(string.Format("CreateLateSlides had an error and the error message={0}", ex.Message), System.Diagnostics.EventLogEntryType.Information); } createdCount++; Repository.Utility.WriteLog("CreateLateSlides completed", System.Diagnostics.EventLogEntryType.Information); }
public static string GetChartType(ChartType value) { return value.ToString().Substring(0, 1).ToLower(); }
/// <summary> /// Initializes a new instance of the Chart class with the specified chart type. /// </summary> public Chart(ChartType type) : this() { Type = type; }
private DataSet GetChartData(ChartType chartType) { using (SqlConnection sqlConnection = new SqlConnection(this._QuotationConnectionString)) { try { sqlConnection.Open(); //SqlCommand command = sqlConnection.CreateCommand(); //command.CommandText = "SELECT TOP 10 * FROM ChartMinutes1 cm"; //command.CommandType = CommandType.Text; //int commandTimeout = string.IsNullOrEmpty(this._ChartCommandTimeOut) ? 60 * 90 : (int)TimeSpan.Parse(this._ChartCommandTimeOut).TotalSeconds; //command.CommandTimeout = commandTimeout; //default 90 minutes //SqlDataAdapter dataAdapter = new SqlDataAdapter(); //dataAdapter.SelectCommand = command; //DataSet dataSet = new DataSet(); //dataAdapter.Fill(dataSet); SqlCommand command = sqlConnection.CreateCommand(); command.CommandText = "dbo.P_GetChartData2ForQuotationServer"; command.CommandType = CommandType.StoredProcedure; int commandTimeout = 60;//string.IsNullOrEmpty(this._ChartCommandTimeOut) ? 60 * 90 : (int)TimeSpan.Parse(this._ChartCommandTimeOut).TotalSeconds; command.CommandTimeout = commandTimeout; //default 90 minutes command.Parameters.Add(new SqlParameter("@chartType", chartType.ToString())); SqlDataAdapter dataAdapter = new SqlDataAdapter(); dataAdapter.SelectCommand = command; DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet); //string[] tableNames = new string[]{ // "Minute1", // "Minute5", // "Minute15", // "Minute30", // "Hour1", // "Hour2", // "Hour3", // "Hour4", // "Hour5", // "Hour6", // "Hour7", // "Hour8" //}; //if (dataSet.Tables.Count != tableNames.Length) // throw new ApplicationException("Get initial data failed"); //for (int i = 0; i < dataSet.Tables.Count; i++) //{ // dataSet.Tables[i].TableName = tableNames[i]; //} return dataSet; } catch (Exception ex) { Manager.Common.Logger.TraceEvent(TraceEventType.Error, "FillDataSet{0}", ex.ToString()); } return null; } }
/// <summary> /// Chart Constructor: /// </summary> /// <param name="name">Name of the Chart</param> /// <param name="type"> Type of the chart</param> public Chart(string name, ChartType type = QuantConnect.ChartType.Overlay) { this.Name = name; this.Series = new Dictionary<string, Series>(); this.ChartType = type; }
private DateTime Round(ChartType chartType, DateTime dateTime) { if ((int)chartType >= (int)ChartType.Hour1) { return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour / ((int)chartType / 60) * ((int)chartType / 60), 0, 0, dateTime.Kind); } else { return new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, 0, 0, dateTime.Kind).AddMinutes((dateTime.Minute / (int)chartType) * (int)chartType); } }
public IChart GetChart(ChartType type) { return(new PieChart()); }
public string generateChart( ChartType chart ) { this.javascript = "<script Language='Javascript'>" + Environment.NewLine; this.javascript = this.javascript + "function drawChart() {" + Environment.NewLine; this.javascript = this.javascript + " var data = new google.visualization.DataTable();" + Environment.NewLine; this.javascript = this.javascript + this.data + Environment.NewLine; this.javascript = this.javascript + " var options = {" + Environment.NewLine; this.javascript = this.javascript + " 'title': '" + this.title + "'," + Environment.NewLine; object javascript = this.javascript; this.javascript = string.Concat( new object[] { javascript, " 'width': ", this.width, ", 'height': ", this.height, "};" } ); string str = this.javascript + Environment.NewLine; this.javascript = str + " var chart = new google.visualization." + chart.ToString() + "(document.getElementById('" + this.elementId + "'));" + Environment.NewLine; this.javascript = this.javascript + " chart.draw(data, options);" + Environment.NewLine; this.javascript = this.javascript + "}" + Environment.NewLine ; this.javascript += "google.charts.setOnLoadCallback( drawChart );" + Environment.NewLine + "</script>" + Environment.NewLine; return this.javascript; }
/// <summary> /// Creates a new instance of the <see cref="BarConfig"/> class. /// </summary> public BarConfig(ChartType type = null) : base(type ?? ChartType.Bar) { }
public void Show(string stockCode, ChartType chartType) { this.stockCode = stockCode; DrawChart(chartType); this.tbTransChart.SelectedIndex = (int)chartType; }
/// <summary> /// /// </summary> /// <param name="val"></param> /// <returns></returns> public static string ToDescriptionString(this ChartType val) { var attributes = val.GetType().GetField(val.ToString())?.GetCustomAttributes(typeof(DescriptionAttribute), false) as DescriptionAttribute[] ?? new DescriptionAttribute[0]; return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
/// <summary> /// Adds a new chart with the specified type to the header or footer. /// </summary> public Chart AddChart(ChartType type) { return(Elements.AddChart(type)); }
public FlexChartFilter(IEnumerable <object> items, string xProperty, string yProperty, ChartType chartType = ChartType.Column) { filterView = new FlexChartFilterView(items, xProperty, yProperty, chartType) { Height = 250 }; filterView.SelectionChanged += (s, e) => OnValueChanged(new ValueChangedEventArgs() { ApplyFilter = filterView.IsLoaded }); propertyX = xProperty; propertyY = yProperty; Control = filterView; this.items = items; }
/// <summary> /// Creates a new instance of <see cref="PieDataset"/> with /// a custom <see cref="ChartType"/>. Use this constructor when /// you implement a pie-like chart. /// </summary> /// <param name="type">The <see cref="ChartType"/> to use instead of <see cref="ChartType.Pie"/>.</param> protected PieDataset(ChartType type) : base(type) { }
public static string GetChartType(this ChartType chartType) { return(chartType.ToString()); }
/// <summary> /// Creates a new instance of <see cref="ScatterDataset"/> with /// a custom <see cref="ChartType"/>. Use this constructor when /// you implement a scatter-like chart. /// </summary> /// <param name="type">The <see cref="ChartType"/> to use instead of <see cref="ChartType.Scatter"/>.</param> protected ScatterDataset(ChartType type) : base(type) { }
public static void SetLocation(ReportItemType pControl, double pLeft, double pTop) { if (pControl is LineType) { LineType vLine = pControl as LineType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is RectangleType) { RectangleType vLine = pControl as RectangleType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is TextboxType) { TextboxType vLine = pControl as TextboxType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is ImageType) { ImageType vLine = pControl as ImageType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is SubreportType) { SubreportType vLine = pControl as SubreportType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is ListType) { ListType vLine = pControl as ListType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is MatrixType) { MatrixType vLine = pControl as MatrixType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is TableType) { TableType vLine = pControl as TableType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is ChartType) { ChartType vLine = pControl as ChartType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } else if (pControl is CustomReportItemType) { CustomReportItemType vLine = pControl as CustomReportItemType; vLine.Left.Value = pLeft; vLine.Top.Value = pTop; } }
internal static string InvalidChartTypeForCombination(ChartType chartType) { return(string.Format("ChartType '{0}' not valid for combination of charts.", chartType.ToString())); }
public static void SetSize(ReportItemType pControl, double pWidth, double pHeight) { if (pControl is LineType) { LineType vLine = pControl as LineType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is RectangleType) { RectangleType vLine = pControl as RectangleType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is TextboxType) { TextboxType vLine = pControl as TextboxType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is ImageType) { ImageType vLine = pControl as ImageType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is SubreportType) { SubreportType vLine = pControl as SubreportType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is ListType) { ListType vLine = pControl as ListType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is MatrixType) { MatrixType vLine = pControl as MatrixType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is TableType) { TableType vLine = pControl as TableType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is ChartType) { ChartType vLine = pControl as ChartType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } else if (pControl is CustomReportItemType) { CustomReportItemType vLine = pControl as CustomReportItemType; vLine.Width.Value = pWidth; vLine.Height.Value = pHeight; } }
private void Add(ChartType chartType) { _chartTypes.Add(chartType.Id, chartType); }
/// <summary> /// Initializes a new instance of the Chart class with the specified chart type. /// </summary> public Chart(ChartType type) : this() { Type = type; }
protected virtual Rect DoSeriesList(Rect position, int chartControlID, ChartType chartType, ChartViewData cdata) { Rect elementPosition = position; Event evt = Event.current; EventType eventType = evt.GetTypeForControl(chartControlID); Vector2 mousePosition = evt.mousePosition; if (m_DragItemIndex != -1) { switch (eventType) { case EventType.MouseUp: if (GUIUtility.hotControl == chartControlID) { GUIUtility.hotControl = 0; m_DragItemIndex = -1; evt.Use(); } break; case EventType.KeyDown: if (evt.keyCode == KeyCode.Escape) { GUIUtility.hotControl = 0; System.Array.Copy(m_OldChartOrder, cdata.order, m_OldChartOrder.Length); m_DragItemIndex = -1; evt.Use(); } break; } } for (int i = cdata.numSeries - 1; i >= 0; --i) { int orderIdx = cdata.order[i]; GUIContent elementLabel = EditorGUIUtility.TempContent(cdata.series[orderIdx].name); elementPosition.height = Styles.seriesLabel.CalcHeight(elementLabel, elementPosition.width); Rect controlPosition = elementPosition; if (i == m_DragItemIndex) { controlPosition.y = mousePosition.y - m_DragDownPos.y; } if (chartType == ChartType.StackedFill) { Rect dragHandlePosition = controlPosition; dragHandlePosition.xMin = dragHandlePosition.xMax - elementPosition.height; switch (eventType) { case EventType.Repaint: // Properly center the drag handle vertically Rect dragHandleRenderedPosition = dragHandlePosition; dragHandleRenderedPosition.height = Styles.seriesDragHandle.fixedHeight; dragHandleRenderedPosition.y += (dragHandlePosition.height - dragHandleRenderedPosition.height) / 2; Styles.seriesDragHandle.Draw(dragHandleRenderedPosition, false, false, false, false); break; case EventType.MouseDown: if (dragHandlePosition.Contains(mousePosition)) { m_DragItemIndex = i; m_DragDownPos = mousePosition; m_DragDownPos.x -= elementPosition.x; m_DragDownPos.y -= elementPosition.y; m_OldChartOrder = new int[cdata.numSeries]; System.Array.Copy(cdata.order, m_OldChartOrder, m_OldChartOrder.Length); GUIUtility.hotControl = chartControlID; evt.Use(); } break; case EventType.MouseDrag: if (i == m_DragItemIndex) { bool moveDn = mousePosition.y > elementPosition.yMax; bool moveUp = mousePosition.y < elementPosition.yMin; if (moveDn || moveUp) { int draggedItemOrder = cdata.order[i]; int targetIdx = moveUp ? Mathf.Min(cdata.numSeries - 1, i + 1) : Mathf.Max(0, i - 1); cdata.order[i] = cdata.order[targetIdx]; cdata.order[targetIdx] = draggedItemOrder; m_DragItemIndex = targetIdx; SaveChartsSettingsOrder(cdata); } evt.Use(); } break; case EventType.MouseUp: if (m_DragItemIndex == i) { evt.Use(); } m_DragItemIndex = -1; break; } } DoSeriesToggle(controlPosition, elementLabel, ref cdata.series[orderIdx].enabled, cdata.series[orderIdx].color, cdata); elementPosition.y += elementPosition.height + EditorGUIUtility.standardVerticalSpacing; } return(elementPosition); }
/// <summary> /// Adds a new chart with the specified type to the cell. /// </summary> public Chart AddChart(ChartType type) { return this.Elements.AddChart(type); }
/// <summary> /// OnAfterRenderAsync 方法 /// </summary> /// <param name="firstRender"></param> protected override async Task OnAfterRenderAsync(bool firstRender) { base.OnAfterRender(firstRender); if (firstRender) { if (OnInit == null) throw new InvalidOperationException("OnInit paramenter must be set"); if (Interop == null) Interop = new JSInterop<Chart>(JSRuntime); var ds = await OnInit.Invoke(); await Interop.InvokeVoidAsync(this, ChartElement, "chart", nameof(Completed), ds, "", ChartType.ToDescriptionString()); } }
protected void LinkButtonStatistic_Click(object sender, EventArgs e) { try { _server = ServerDropDownList.SelectedGameServer; if (_server != null) { //加入权限检查 if (!WebUtil.CheckPrivilege(_server.SecurityObject, OpType.READ, Session)) { Response.Redirect(WebConfig.PageNotEnoughPrivilege, true); } _statisticType = ListBoxStatType.SelectedIndex; _chartType = (ChartType)int.Parse(ListBoxChartType.SelectedValue); int levelFrom = int.Parse(ListBoxLevelFrom.SelectedValue); int levelTo = int.Parse(ListBoxLevelTo.SelectedValue); int roleClass = int.Parse(ListBoxRoleClass.SelectedValue); int sex = int.Parse(ListBoxSex.SelectedValue); int map = int.Parse(ListBoxMap.SelectedValue); StringBuilder whereStatement = new StringBuilder(); whereStatement.Append("WHERE RoleLevel>="); whereStatement.Append(levelFrom); whereStatement.Append(" AND RoleLevel<="); whereStatement.Append(levelTo); if (roleClass >= 0) { whereStatement.Append(" AND RoleType="); whereStatement.Append(roleClass); } if (sex >= 0) { whereStatement.Append(" AND RoleSex="); whereStatement.Append(sex); } if (map >= 0) { whereStatement.Append(" AND EnterMapID="); whereStatement.Append(map); } _whereStatement = whereStatement.ToString(); ZedGraphWebStatistic.Visible = true; } } catch (Exception) { } }
/// <summary> /// Add a sample to the chart specified by the chartName, and seriesName. /// </summary> /// <param name="chartName">String chart name to place the sample.</param> /// <param name="chartType">Type of chart we should create if it doesn't already exist.</param> /// <param name="seriesName">Series name for the chart.</param> /// <param name="seriesType">Series type for the chart.</param> /// <param name="time">Time for the sample</param> /// <param name="unit">Unit of the sample</param> /// <param name="value">Value for the chart sample.</param> public void Sample(string chartName, ChartType chartType, string seriesName, SeriesType seriesType, DateTime time, decimal value, string unit = "$") { lock (_chartLock) { //Add a copy locally: if (!Charts.ContainsKey(chartName)) { Charts.AddOrUpdate(chartName, new Chart(chartName, chartType)); } //Add the sample to our chart: if (!Charts[chartName].Series.ContainsKey(seriesName)) { Charts[chartName].Series.Add(seriesName, new Series(seriesName, seriesType, unit)); } //Add our value: Charts[chartName].Series[seriesName].Values.Add(new ChartPoint(time, value)); } }
private void SetDefaults() { _chartType = ChartType.FastCandlestick; _calendar = new DefaultDiscontinuousDateTimeCalendar(); _selectedCalendar = "Extended"; }