public ChartData GetData(ChartType ct) { if (ct == ChartType.Bubble) { return(BubbleData); } else if (ct == ChartType.Candle || ct == ChartType.HighLowOpenClose) { return(FinancialData); } else if (ct == ChartType.Gantt) { return(GanttData); } else if (ct.ToString().StartsWith("Polar")) { return(PolarData); } else if (ct.ToString().StartsWith("Polygon")) { return(PolygonData); } else { return(DefaultData); } }
void DrawChart() { List <ChartData> dataWindow = new List <ChartData>(chartDataPoints); var timespots = chartDataPoints.Select(x => x.time).ToList().GetRange(windowIndex, chartDataPoints.Count - windowIndex); if (timespots.Count > 0 && timespots[timespots.Count - 1] - timespots[0] > maxTimeGap) { windowIndex += timespots.FindLastIndex(x => timespots[timespots.Count - 1] - x > maxTimeGap); dataWindow = chartDataPoints.GetRange(windowIndex, chartDataPoints.Count - windowIndex); } chart1.Series["Series1"].Points.DataBindXY(dataWindow.Select(x => x.time).ToList(), dataWindow.Select(x => x.gdp).ToList()); chart1.ChartAreas[0].AxisY.Title = chartType.ToString(); switch (chartType) { case ChartType.GDP: chart1.Series["Series1"].Points.DataBindXY(dataWindow.Select(x => x.time).ToList(), dataWindow.Select(x => x.gdp).ToList()); break; case ChartType.CompanyValue: chart1.Series["Series1"].Points.DataBindXY(dataWindow.Select(x => x.time).ToList(), dataWindow.Select(x => x.marketValue).ToList()); break; } List <double> dataY = chart1.Series["Series1"].Points.Select(x => x.YValues[0]).ToList(); //if(dataY.Count>0)chart1.ChartAreas[0].AxisY.Minimum = (int)MyMath.Clamp(dataY[0] - dataY[0] / 6, 0, dataY[0]); }
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(); }
protected void Page_Load(object sender, EventArgs e) { try { Property = REIQ.Access.Property.GetFromPropertyId(this.PropertyId); if (Property != null) { Suburb = REIQ.Access.Suburb.GetFromName(Property.suburb); if (!IsPostBack) { //Suburb Chart stuff ch = new ChartClass(); ch.intChartRange = Convert.ToInt32("4"); cboChartType.SelectedValue = ChartType.ToString(); if (Suburb != null) { DataTable dtsuburbChart = ch.GetSubrub("any", Suburb.name, Suburb.postcode == null ? "0" : Suburb.postcode.ToString()); if (dtsuburbChart.Rows.Count > 0) { chartwork(int.Parse(dtsuburbChart.Rows[0]["suburbid"].ToString()), dtsuburbChart.Rows[0]["suburbname"].ToString()); } } } } } catch (Exception ex) { AutoMail.sendErrorMail(ex); } }
public void AddData(string name, ChartType type, List <T> data) { var seriesViewResult = new SeriesViewResult <T> { name = name, type = type.ToString(), data = data }; highCharts.series.Add(seriesViewResult); }
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); }
public string generateChart(ChartType chart) { this.javascript = "<script type=\"text/javascript\" src=\"https://www.google.com/jsapi\"></script>"; this.javascript = this.javascript + "<script type=\"text/javascript\">"; this.javascript = this.javascript + "google.load('visualization', '1.0', { 'packages': ['corechart']});"; this.javascript = this.javascript + "google.setOnLoadCallback(drawChart);"; this.javascript = this.javascript + "var data, options, chart, view; "; this.javascript = this.javascript + "function drawChart() {"; this.javascript = this.javascript + "data = new google.visualization.DataTable();"; this.javascript = this.javascript + this.data; this.javascript = this.javascript + "options = {"; this.javascript = this.javascript + "'title': '" + this.title + "',"; this.javascript = this.javascript + "'colors': ['" + this.color + "'],"; this.javascript = this.javascript + "vAxis: {title: '" + this.vAxisTitle + "' },"; this.javascript = this.javascript + "hAxis: {title: '" + this.hAxisTitle + "' },"; object javascript = this.javascript; this.javascript = string.Concat(new object[] { javascript, "'width': ", 1200, ", 'height': ", 600, "};" }); string str = this.javascript; this.javascript = str + "chart = new google.visualization." + chart.ToString() + "(document.getElementById('" + this.elementId + "'));"; this.javascript = this.javascript + "view = new google.visualization.DataView(data); "; this.javascript = this.javascript + "view.setColumns([0, 1, { sourceColumn: 1, role: 'annotation' }]); "; this.javascript = this.javascript + "chart = new google.visualization.BarChart(document.getElementById('" + this.elementId + "'));"; this.javascript = this.javascript + "chart.draw(view, options); "; this.javascript = this.javascript + "};" + "function setData(jsonData){ data = new google.visualization.DataTable(jsonData); " + "}; " + "function getData(){ " + " return data; "+ "}; " + "function updateChart() { " + " data = getData(); " + " chart.draw(data, options); " + "}; " + " function setChart(json){ " + " data = new google.visualization.DataTable(); " + " var json = json; for(var i=0; i< json.cols.length; i++ ){ " + " var col = json.cols[i]; " + " data.addColumn( col.type, col.val ); " + " }; " + " var arr = []; " + " for(var i=0; i< json.rows.length; i++ ){ " + " var col = json.rows[i]; " + " arr.push([ col.name, col.val ]); " + " }; " + " data.addRows(arr); " + " view = new google.visualization.DataView(data); " + " view.setColumns([0, 1, { sourceColumn: 1, role: 'annotation' }]); " + " chart = new google.visualization.BarChart(document.getElementById('" + this.elementId + "')); " + " chart.draw(view, options); "+ "}; " + "</script>"; return(this.javascript); }
public ChartBuilder(ChartType type) { _chart = new(); _chart.Data = new(); _chart.Type = type.ToString(); _type = type; _hasDataset = false; _hasLabels = false; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ChartType type = (ChartType)value; if (parameter.ToString().Contains(type.ToString())) { return(Visibility.Visible); } else { return(Visibility.Collapsed); } }
public ChartTemplate SetType(ChartType type) { int pos = strTemp.IndexOf("type:"); StringBuilder build = new StringBuilder(); build.Append(strTemp.Substring(0, pos + 5)); build.Append("'" + type.ToString() + "'"); int posDataEnd = strTemp.IndexOf(",", pos); build.Append(strTemp.Substring(posDataEnd, strTemp.Length - posDataEnd)); strTemp = build.ToString(); return(this); }
/// <summary> /// 차트 마우스 더블클릭 이벤트 핸들러 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Chart_MouseDouble_Click(object sender, ChartFX.WinForms.HitTestEventArgs e) { int point = 0; if (e.HitType == ChartFX.WinForms.HitType.Axis) { point = (int)e.Value; } if (e.HitType == ChartFX.WinForms.HitType.Point) { point = e.Point; } if (point >= 0) { if (uiChart_BarLine.Points[point].Tag == null) { return; } if (_CType == ChartType.OPENING) { return; } this.Cursor = Cursors.WaitCursor; this.ChartDoubleClickEvent?.Invoke(_CType.ToString(), uiChart_BarLine.Points[point].Tag.ToString(), uiChart_BarLine.Data[(int)Type.BAR, point].ToString()); CheckChartType(point, e); ChartDeepSearch(point, e); this.Cursor = Cursors.Default; } }
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> /// Gets the chart type string. /// </summary> /// <param name="chartType">Type of the chart.</param> /// <returns></returns> internal static string GetChartTypeString(ChartType chartType) { switch (chartType) { case ChartType.Pie: return("pie"); case ChartType.Line: return("line"); case ChartType.LineDot: return("line_dot"); case ChartType.LineHollow: return("line_hollow"); } throw new NotImplementedException("ChartType" + chartType.ToString() + " not recognized"); }
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); }
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(); }
/// <summary> /// Select either the Overview or Category tabs. /// </summary> private void SelectTab(ChartType chartType) { // The user toggles between the tabs using these two buttons. UltraButton activeButton; UltraButton otherButton; // Get the button they clicked and, by extension, the button they did not click. switch (chartType) { case ChartType.Category: activeButton = this.btnCategory; otherButton = this.btnOverview; break; case ChartType.Overview: activeButton = this.btnOverview; otherButton = this.btnCategory; break; default: Debug.Fail("Unknown ChartType"); return; } // Give the active button a white background to highlight it. activeButton.Appearance.ImageBackground = Utilities.GetCachedImage(CachedImages.WhiteButtonTransparent); activeButton.Appearance.ForeColor = Color.FromArgb(102, 102, 102); // Give the other button no background, so it's de-emphasized. otherButton.Appearance.ResetImageBackground(); otherButton.Appearance.ForeColor = Color.FromArgb(154, 154, 154); // Select the appropriate tab. This tab is in Wizard mode, so it has no UI. That's // why we are using the buttons. this.tabChartType.SelectedTab = this.tabChartType.Tabs[chartType.ToString()]; }
public static string GetChartType(ChartType value) { return value.ToString().Substring(0, 1).ToLower(); }
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> /// /// </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); }
public static string GetChartType(this ChartType chartType) { return(chartType.ToString()); }
protected void Page_Load(object sender, EventArgs e) { try { Suburb = REIQ.Access.Suburb.GetFromName(SuburbName); if (!IsPostBack) { //Binding Suburbs //DataTable dtsuburb = ch.GetAllSubrubWithdesc("1000"); //ahc.connection.Close(); //for (int i = 0; i < dtsuburb.Rows.Count; i++) //{ // cboSuburbInfo.Items.Add(new ListItem(dtsuburb.Rows[i]["name"].ToString() + ", " + dtsuburb.Rows[i]["postcode"].ToString(), dtsuburb.Rows[i]["sid"].ToString())); //} //cboSuburbInfo.DataSource = REIQ.Access.Suburb.GetAllSuburbsByTop(1000); //cboSuburbInfo.Items.Insert(0, new ListItem("-Select Suburb-", "")); //cboSuburbInfo.DataBind(); //Bedrooms setup cboSuburbInfo.Items.Add(new ListItem("Select Suburb", "")); foreach (REIQ.Entities.Suburb suburb in REIQ.Access.Suburb.GetAllSuburbsByTop(2000)) { cboSuburbInfo.Items.Add(new ListItem(suburb.name, suburb.name)); } cboSuburbInfo.DataBind(); cboSuburbInfo.SelectedValue = SuburbName; //if (!String.IsNullOrEmpty(Request.QueryString["su"]) && Request.QueryString["postcode"] != null) //{ // strSearchSuburb = Request.QueryString["su"].ToString(); // strSearchPostcode = Request.QueryString["postcode"].ToString(); //} //else //{ // //cboSuburbInfo.SelectedIndex = 1; // //DataRow[] drsuburb = dtsuburb.Select("sid=" + cboSuburbInfo.SelectedValue); // //strSearchSuburb = drsuburb[0]["name"].ToString(); // //strSearchPostcode = drsuburb[0]["postcode"].ToString(); //} //Suburb Chart stuff ch = new ChartClass(); ch.intChartRange = Convert.ToInt32("4"); cboChartType.SelectedValue = ChartType.ToString(); if (Suburb != null) { DataTable dtsuburbChart = ch.GetSubrub("any", Suburb.name, Suburb.postcode == null ? "0" : Suburb.postcode.ToString()); if (dtsuburbChart.Rows.Count > 0) { chartwork(int.Parse(dtsuburbChart.Rows[0]["suburbid"].ToString()), dtsuburbChart.Rows[0]["suburbname"].ToString()); } } } } catch (Exception ex) { AutoMail.sendErrorMail(ex); } }
public void SetUserGraph(ChartType chartType) => _secureStorage.StoreByte(StorageConstants.KEY_USER_GRAPH, Encoding.UTF8.GetBytes(chartType.ToString()));
internal static string InvalidChartTypeForCombination(ChartType chartType) { return string.Format("ChartType '{0}' not valid for combination of charts.", chartType.ToString()); }
internal override Hashtable ToHashtable() { Hashtable hashtables = new Hashtable(); bool? alignTicks = this.AlignTicks; bool? alignTicksDefaultValue = this.AlignTicks_DefaultValue; if ((alignTicks.GetValueOrDefault() == alignTicksDefaultValue.GetValueOrDefault() ? alignTicks.HasValue != alignTicksDefaultValue.HasValue : true)) { hashtables.Add("alignTicks", this.AlignTicks); } if (this.Animation.IsDirty()) { hashtables.Add("animation", this.Animation.ToJSON()); } if (this.BackgroundColor != this.BackgroundColor_DefaultValue) { hashtables.Add("backgroundColor", this.BackgroundColor); } if (this.BorderColor != this.BorderColor_DefaultValue) { hashtables.Add("borderColor", this.BorderColor); } double?borderRadius = this.BorderRadius; double?borderRadiusDefaultValue = this.BorderRadius_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("borderRadius", this.BorderRadius); } borderRadiusDefaultValue = this.BorderWidth; borderRadius = this.BorderWidth_DefaultValue; if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true)) { hashtables.Add("borderWidth", this.BorderWidth); } if (this.ClassName != this.ClassName_DefaultValue) { hashtables.Add("className", this.ClassName); } borderRadius = this.ColorCount; borderRadiusDefaultValue = this.ColorCount_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("colorCount", this.ColorCount); } if (this.Description != this.Description_DefaultValue) { hashtables.Add("description", this.Description); } if (this.Events.IsDirty()) { hashtables.Add("events", this.Events.ToHashtable()); } if (this.Height != this.Height_DefaultValue) { hashtables.Add("height", this.Height); } alignTicksDefaultValue = this.IgnoreHiddenSeries; alignTicks = this.IgnoreHiddenSeries_DefaultValue; if ((alignTicksDefaultValue.GetValueOrDefault() == alignTicks.GetValueOrDefault() ? alignTicksDefaultValue.HasValue != alignTicks.HasValue : true)) { hashtables.Add("ignoreHiddenSeries", this.IgnoreHiddenSeries); } alignTicks = this.Inverted; alignTicksDefaultValue = this.Inverted_DefaultValue; if ((alignTicks.GetValueOrDefault() == alignTicksDefaultValue.GetValueOrDefault() ? alignTicks.HasValue != alignTicksDefaultValue.HasValue : true)) { hashtables.Add("inverted", this.Inverted); } if (this.Margin != this.Margin_DefaultValue) { hashtables.Add("margin", this.Margin); } borderRadiusDefaultValue = this.MarginBottom; borderRadius = this.MarginBottom_DefaultValue; if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true)) { hashtables.Add("marginBottom", this.MarginBottom); } borderRadius = this.MarginLeft; borderRadiusDefaultValue = this.MarginLeft_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("marginLeft", this.MarginLeft); } borderRadiusDefaultValue = this.MarginRight; borderRadius = this.MarginRight_DefaultValue; if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true)) { hashtables.Add("marginRight", this.MarginRight); } borderRadius = this.MarginTop; borderRadiusDefaultValue = this.MarginTop_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("marginTop", this.MarginTop); } if (this.Options3d.IsDirty()) { hashtables.Add("options3d", this.Options3d.ToHashtable()); } if (this.PanKey != this.PanKey_DefaultValue) { ChartPanKey panKey = this.PanKey; hashtables.Add("panKey", Highcharts.FirstCharacterToLower(panKey.ToString())); } alignTicksDefaultValue = this.Panning; alignTicks = this.Panning_DefaultValue; if ((alignTicksDefaultValue.GetValueOrDefault() == alignTicks.GetValueOrDefault() ? alignTicksDefaultValue.HasValue != alignTicks.HasValue : true)) { hashtables.Add("panning", this.Panning); } if (this.PinchType != this.PinchType_DefaultValue) { ChartPinchType pinchType = this.PinchType; hashtables.Add("pinchType", Highcharts.FirstCharacterToLower(pinchType.ToString())); } if (this.PlotBackgroundColor != this.PlotBackgroundColor_DefaultValue) { hashtables.Add("plotBackgroundColor", this.PlotBackgroundColor); } if (this.PlotBackgroundImage != this.PlotBackgroundImage_DefaultValue) { hashtables.Add("plotBackgroundImage", this.PlotBackgroundImage); } if (this.PlotBorderColor != this.PlotBorderColor_DefaultValue) { hashtables.Add("plotBorderColor", this.PlotBorderColor); } borderRadiusDefaultValue = this.PlotBorderWidth; borderRadius = this.PlotBorderWidth_DefaultValue; if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true)) { hashtables.Add("plotBorderWidth", this.PlotBorderWidth); } if (this.PlotShadow.IsDirty()) { hashtables.Add("plotShadow", this.PlotShadow.ToJSON()); } alignTicks = this.Polar; alignTicksDefaultValue = this.Polar_DefaultValue; if ((alignTicks.GetValueOrDefault() == alignTicksDefaultValue.GetValueOrDefault() ? alignTicks.HasValue != alignTicksDefaultValue.HasValue : true)) { hashtables.Add("polar", this.Polar); } alignTicksDefaultValue = this.Reflow; alignTicks = this.Reflow_DefaultValue; if ((alignTicksDefaultValue.GetValueOrDefault() == alignTicks.GetValueOrDefault() ? alignTicksDefaultValue.HasValue != alignTicks.HasValue : true)) { hashtables.Add("reflow", this.Reflow); } if (this.RenderTo != this.RenderTo_DefaultValue) { hashtables.Add("renderTo", this.RenderTo); } if (this.ResetZoomButton.IsDirty()) { hashtables.Add("resetZoomButton", this.ResetZoomButton.ToHashtable()); } if (this.SelectionMarkerFill != this.SelectionMarkerFill_DefaultValue) { hashtables.Add("selectionMarkerFill", this.SelectionMarkerFill); } if (this.Shadow != this.Shadow_DefaultValue) { hashtables.Add("shadow", this.Shadow); } alignTicks = this.ShowAxes; alignTicksDefaultValue = this.ShowAxes_DefaultValue; if ((alignTicks.GetValueOrDefault() == alignTicksDefaultValue.GetValueOrDefault() ? alignTicks.HasValue != alignTicksDefaultValue.HasValue : true)) { hashtables.Add("showAxes", this.ShowAxes); } borderRadius = this.SpacingBottom; borderRadiusDefaultValue = this.SpacingBottom_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("spacingBottom", this.SpacingBottom); } borderRadiusDefaultValue = this.SpacingLeft; borderRadius = this.SpacingLeft_DefaultValue; if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true)) { hashtables.Add("spacingLeft", this.SpacingLeft); } borderRadius = this.SpacingRight; borderRadiusDefaultValue = this.SpacingRight_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("spacingRight", this.SpacingRight); } borderRadiusDefaultValue = this.SpacingTop; borderRadius = this.SpacingTop_DefaultValue; if ((borderRadiusDefaultValue.GetValueOrDefault() == borderRadius.GetValueOrDefault() ? borderRadiusDefaultValue.HasValue != borderRadius.HasValue : true)) { hashtables.Add("spacingTop", this.SpacingTop); } if (this.Style != this.Style_DefaultValue) { hashtables.Add("style", this.Style); } if (this.Type != this.Type_DefaultValue) { ChartType type = this.Type; hashtables.Add("type", Highcharts.FirstCharacterToLower(type.ToString())); } if (this.TypeDescription != this.TypeDescription_DefaultValue) { hashtables.Add("typeDescription", this.TypeDescription); } borderRadius = this.Width; borderRadiusDefaultValue = this.Width_DefaultValue; if ((borderRadius.GetValueOrDefault() == borderRadiusDefaultValue.GetValueOrDefault() ? borderRadius.HasValue != borderRadiusDefaultValue.HasValue : true)) { hashtables.Add("width", this.Width); } if (this.ZoomType != this.ZoomType_DefaultValue) { ChartZoomType zoomType = this.ZoomType; hashtables.Add("zoomType", Highcharts.FirstCharacterToLower(zoomType.ToString())); } return(hashtables); }
/// <summary> /// /// </summary> /// <param name="dt"></param> /// <param name="colOfGroupField"></param> /// <param name="colOfGroupName"></param> /// <param name="colOfNumField"></param> /// <param name="colOfNumName"></param> /// <param name="title"></param> /// <param name="chartHeight"></param> /// <param name="chartWidth"></param> /// <param name="ct"></param> /// <returns></returns> public static string GenerChart(DataTable dt, string colOfGroupField, string colOfGroupName, string colOfNumField, string colOfNumName, string title, int chartHeight, int chartWidth, ChartType ct) { string strCategory = ""; // "1" + '\t' + "2" + '\t' + "3" + '\t'+"4" + '\t' + "5" + '\t' + "6" + '\t'; string strValue = ""; // "9" + '\t' + "8" + '\t' + "4" + '\t'+"10" + '\t' + "12" + '\t' + "6" + '\t'; ////声明对象 //ChartSpace ThisChart = new ChartSpaceClass(); //ChChart ThisChChart = ThisChart.Charts.Add(0); //ChSeries ThisChSeries = ThisChChart.SeriesCollection.Add(0); ////显示图例 //ThisChChart.HasLegend = true; ////标题 //ThisChChart.HasTitle = true; //ThisChChart.Title.Caption = title; ////给定x,y轴图示说明 //ThisChChart.Axes[0].HasTitle = true; //ThisChChart.Axes[1].HasTitle = true; //ThisChChart.Axes[0].Title.Caption = colOfGroupName; //ThisChChart.Axes[1].Title.Caption = colOfNumName; //switch (ct) //{ // case ChartType.Histogram: // foreach (DataRow dr in dt.Rows) // { // strCategory += dr[colOfGroupField].ToString() + '\t'; // strValue += dr[colOfNumField].ToString() + '\t'; // } // ThisChChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered; // ThisChChart.Overlap = 50; // //旋转 // ThisChChart.Rotation = 360; // ThisChChart.Inclination = 10; // //背景颜色 // ThisChChart.PlotArea.Interior.Color = "red"; // //底色 // ThisChChart.PlotArea.Floor.Interior.Color = "green"; // ////给定series的名字 // ThisChSeries.SetData(ChartDimensionsEnum.chDimSeriesNames, // ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), colOfGroupName); // //给定分类 // ThisChSeries.SetData(ChartDimensionsEnum.chDimCategories, // ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strCategory); // //给定值 // ThisChSeries.SetData(ChartDimensionsEnum.chDimValues, // ChartSpecialDataSourcesEnum.chDataLiteral.GetHashCode(), strValue); // break; // case ChartType.Pie: // // 产生数据 // foreach (DataRow dr in dt.Rows) // { // strCategory += dr[colOfGroupField].ToString() + '\t'; // strValue += dr[colOfNumField].ToString() + '\t'; // } // ThisChChart.Type = ChartChartTypeEnum.chChartTypePie3D; // ThisChChart.SeriesCollection.Add(0); // //在图表上显示数据 // ThisChChart.SeriesCollection[0].DataLabelsCollection.Add(); // ThisChChart.SeriesCollection[0].DataLabelsCollection[0].Position = ChartDataLabelPositionEnum.chLabelPositionAutomatic; // ThisChChart.SeriesCollection[0].Marker.Style = ChartMarkerStyleEnum.chMarkerStyleCircle; // //给定该组图表数据的名字 // ThisChChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, // +(int)ChartSpecialDataSourcesEnum.chDataLiteral, "strSeriesName"); // //给定数据分类 // ThisChChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, // +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strCategory); // //给定值 // ThisChChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, // (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue); // break; // case ChartType.Line: // // 产生数据 // foreach (DataRow dr in dt.Rows) // { // strCategory += dr[colOfGroupField].ToString() + '\t'; // strValue += dr[colOfNumField].ToString() + '\t'; // } // ThisChChart.Type = ChartChartTypeEnum.chChartTypeLineStacked; // ThisChChart.SeriesCollection.Add(0); // //在图表上显示数据 // ThisChChart.SeriesCollection[0].DataLabelsCollection.Add(); // //ThisChChart.SeriesCollection[0].DataLabelsCollection[0].Position=ChartDataLabelPositionEnum.chLabelPositionAutomatic; // //ThisChChart.SeriesCollection[0].DataLabelsCollection[0].Position=ChartDataLabelPositionEnum.chLabelPositionOutsideBase; // ThisChChart.SeriesCollection[0].Marker.Style = ChartMarkerStyleEnum.chMarkerStyleCircle; // //给定该组图表数据的名字 // ThisChChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, // +(int)ChartSpecialDataSourcesEnum.chDataLiteral, "strSeriesName"); // //给定数据分类 // ThisChChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, // +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strCategory); // //给定值 // ThisChChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, // (int)ChartSpecialDataSourcesEnum.chDataLiteral, strValue); // break; //} //导出图像文件 //ThisChart.ExportPicture("G:\\chart.gif","gif",600,350); string fileName = ct.ToString() + PubClass.GenerTempFileName("GIF"); //string strAbsolutePath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "\\Temp\\" + fileName; //try //{ // ThisChart.ExportPicture(strAbsolutePath, "GIF", chartWidth, chartHeight); //} //catch (Exception ex) //{ // throw new Exception("@不能创建文件,可能是权限的问题,请把该目录设置为任何人都可以修改。" + strAbsolutePath + " Exception:" + ex.Message); //} return(fileName); }
public static string GetChartType(ChartType value) { return(value.ToString().Substring(0, 1).ToLower()); }
public void ExpReort(string taskName, ChartType chartType) { fileName = chartType.ToString() + ".jasper"; ExpReort(taskName); }
public ChartData GetData(ChartType ct) { if (ct == ChartType.Bubble) return BubbleData; else if (ct == ChartType.Candle || ct == ChartType.HighLowOpenClose) return FinancialData; else if (ct == ChartType.Gantt) return GanttData; else if (ct.ToString().StartsWith("Polar")) return PolarData; else if (ct.ToString().StartsWith("Polygon")) return PolygonData; else return DefaultData; }
// start the process of chart requisition for the server public void getchart() { if (verifyparameters()) { string url = ""; if (Datatype == DataType.Manual) { url = "http://localhost:3000/chartgen.html?x=" + x + "&y=" + y + "&chart=" + Charttype.ToString().ToLower(); } else { url = "http://localhost:3000/generate/" + dataset_name + "/chartgen.html?x=" + x + "&y=" + y + "&chart=" + Charttype.ToString().ToLower(); } if (maxdimensions() > 2) { url += "&z=" + z; } if (maxdimensions() > 3) { url += "&w=" + w; } // url += "&colors="; // String[] colorholder = new String[colors.Length]; // for (int i = 0; i < colors.Length; i++) // { // colorholder[i] = colorToWebColor(colors[i]); // "rgb(" + ((int)(colors[i].r * 255f)) + "," + ((int)(colors[i].g * 255f)) + "," + ((int)(colors[i].b * 255f)) + ")"; // //Debug.Log(colorholder[i], ); // } // url += String.Join(";", colorholder); url += "&title=" + title; // url += "&background=" + colorToWebColor(background); String[] labels = { xlabel, ylabel, wlabel, zlabel }; String[] label_axis = { "x", "y", "w", "z" }; for (int i = 0; i < labels.Length; i++) { if (labels[i] != "") { url += "&" + label_axis[i] + "label=" + labels[i]; } } url += "&filter=" + filter; Debug.Log("Requisition: " + url); StartCoroutine(GetRequest(url)); } }
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.ToString(); }
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; }
public static string ChartTypeString(ChartType type) { return(type.ToString().Replace("_", "-")); }
internal static string InvalidChartTypeForCombination(ChartType chartType) { return(string.Format("ChartType '{0}' not valid for combination of charts.", chartType.ToString())); }
private void GetChartTypes() { DropDownList2.Items.Add(""); foreach (int ChartType in Enum.GetValues(typeof(SeriesChartType))) { ListItem li = new ListItem(Enum.GetName(typeof(SeriesChartType), ChartType), ChartType.ToString()); DropDownList2.Items.Add(li); } }