We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Axis visible

Thread ID:

Created:

Updated:

Platform:

Replies:

40628 Feb 8,2006 01:54 PM UTC Feb 15,2006 09:33 AM UTC Windows Forms 4
loading
Tags: Chart
Administrator [Syncfusion]
Asked On February 8, 2006 01:54 PM UTC

If I add multiple axes to a chart, they are all displayed. How can I hide some of the axes? E.g. I want to show project costs 1. against date 2. against working hours Regards Andi

Geetha M [Syncfusion]
Replied On February 9, 2006 06:25 AM UTC

Hi Andi, I am afraid there is no such property using which one can hide the axes. But it can be done indirectly as discussed below: To hide Secondary axes: Remove and add from the collection. To hide Primary axes: Disable the Primary axis labels and change the axis color to transparent. I have attached a sample which can hide and show the PrimaryXAxis and Secondary X Axis. F40628.zip Please implement this and let me know if this helps you. Thanks for your interest in Syncfusion products. Regards, Geetha

Administrator [Syncfusion]
Replied On February 9, 2006 02:45 PM UTC

Hi Geetha, thanks for the reply. What I need to display are two curves with the same y-values but not the same x-values. (E.g. costs against time and working hors) I don''t show the curves at the same time. My idea was to create two series and two axes with different titles and scales. If the user chooses the curve, I hide the curve and axis that is not needed. Now I implemented an extra class that holds the points of the curves. When the user chooses, I copy the desired points into the series. (See attachment) Not a nice solution, because as the curves get large, I shovel around a lot of data. Do you have a better idea? Regards Andi P.S.: I tried to send you a 12kb .zip file, but the server complains: " Only .zip files under 2MB may be attached to a post" I just changed the example you gave me. This is Form1.cs: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using Syncfusion.Windows.Forms.Chart; namespace I40628 { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private Curve curve1 = new Curve(); private Curve curve2 = new Curve(); private Syncfusion.Windows.Forms.Chart.ChartControl chartControl1; private ChartAxis secXAxis = new ChartAxis(); private System.Windows.Forms.Panel panel1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RadioButton radioButtonWorkingHours; private System.Windows.Forms.RadioButton radioButtonTime; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.chartControl1 = new Syncfusion.Windows.Forms.Chart.ChartControl(); this.panel1 = new System.Windows.Forms.Panel(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.radioButtonWorkingHours = new System.Windows.Forms.RadioButton(); this.radioButtonTime = new System.Windows.Forms.RadioButton(); this.panel1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // chartControl1 // this.chartControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.chartControl1.Controls.Add(this.chartControl1.Legend); // // chartControl1.Legend // this.chartControl1.Legend.Location = new System.Drawing.Point(346, 209); this.chartControl1.Legend.Name = ""; this.chartControl1.Legend.TabIndex = 3; this.chartControl1.Location = new System.Drawing.Point(0, 0); this.chartControl1.Name = "chartControl1"; this.chartControl1.PrimaryXAxis.Orientation = Syncfusion.Windows.Forms.Chart.ChartOrientation.Horizontal; this.chartControl1.PrimaryYAxis.Title = "Cost"; this.chartControl1.Size = new System.Drawing.Size(432, 407); this.chartControl1.TabIndex = 0; this.chartControl1.Text = "Essential Chart"; this.chartControl1.ToolBar.Location = new System.Drawing.Point(0, 0); // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.BackColor = System.Drawing.Color.White; this.panel1.Controls.Add(this.groupBox2); this.panel1.Location = new System.Drawing.Point(432, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(120, 407); this.panel1.TabIndex = 2; // // groupBox2 // this.groupBox2.Controls.Add(this.radioButtonWorkingHours); this.groupBox2.Controls.Add(this.radioButtonTime); this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System; this.groupBox2.Location = new System.Drawing.Point(8, 56); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(104, 112); this.groupBox2.TabIndex = 6; this.groupBox2.TabStop = false; this.groupBox2.Text = "Cost against"; // // radioButtonWorkingHours // this.radioButtonWorkingHours.FlatStyle = System.Windows.Forms.FlatStyle.System; this.radioButtonWorkingHours.Location = new System.Drawing.Point(8, 64); this.radioButtonWorkingHours.Name = "radioButtonWorkingHours"; this.radioButtonWorkingHours.Size = new System.Drawing.Size(80, 32); this.radioButtonWorkingHours.TabIndex = 1; this.radioButtonWorkingHours.Text = "working hours"; // // radioButtonTime // this.radioButtonTime.Checked = true; this.radioButtonTime.FlatStyle = System.Windows.Forms.FlatStyle.System; this.radioButtonTime.Location = new System.Drawing.Point(8, 24); this.radioButtonTime.Name = "radioButtonTime"; this.radioButtonTime.Size = new System.Drawing.Size(80, 24); this.radioButtonTime.TabIndex = 0; this.radioButtonTime.TabStop = true; this.radioButtonTime.Text = "time"; this.radioButtonTime.CheckedChanged += new System.EventHandler(this.radioButtonTime_CheckedChanged); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(552, 405); this.Controls.Add(this.chartControl1); this.Controls.Add(this.panel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "Form1"; this.Text = "Sample"; this.Load += new System.EventHandler(this.Form1_Load); this.panel1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.Run(new Form1()); } private void Form1_Load(object sender, System.EventArgs e) { this.chartControl1.Model.ColorModel.Palette = ChartColorPalette.Nature; InitializeChartData(); InitializeChartAppearance(); radioButtonTime_CheckedChanged(sender, e); } protected void InitializeChartData() { ChartSeries series1 = this.chartControl1.Model.NewSeries(" Series 0",ChartSeriesType.Area ); series1.Text = series1.Name; this.chartControl1.Series.Add(series1); curve1.Add(1,100); curve1.Add(2,200); curve1.Add(4,300); curve1.Add(7,400); curve1.Add(10,500); curve2.Add(1,100); curve2.Add(5,200); curve2.Add(6,300); curve2.Add(9,400); curve2.Add(12,500); } protected void InitializeChartAppearance() { // We don''t use indexed mode with multiple axes. this.chartControl1.Indexed = false; this.chartControl1.LegendPosition = ChartDock.Top; this.chartControl1.PrimaryXAxis.DrawGrid = false; this.chartControl1.PrimaryYAxis.DrawGrid = false; } private void radioButtonTime_CheckedChanged(object sender, System.EventArgs e) { if ( radioButtonTime.Checked ) { this.chartControl1.Series[0].Points.Clear(); for ( int index = 0; index < curve1.Count; index++ ) { this.chartControl1.Series[0].Points.Add(curve1.GetX(index), curve1.GetY(index)); } this.chartControl1.Series[0].XAxis.Title = "Time"; } else { this.chartControl1.Series[0].Points.Clear(); for ( int index = 0; index < curve1.Count; index++ ) { this.chartControl1.Series[0].Points.Add(curve2.GetX(index), curve2.GetY(index)); } this.chartControl1.Series[0].XAxis.Title = "Working hours"; } } } // primitive curve class, // can be considered as data point series class Curve { private System.Collections.ArrayList pointsX = new ArrayList(); private System.Collections.ArrayList pointsY = new ArrayList(); public void Add(int x, int y) { pointsX.Add(x); pointsY.Add(y); } public int GetX(int index) { return (int)pointsX[index]; } public int GetY(int index) { return (int)pointsY[index]; } public int Count { get { return pointsX.Count; } } } }

Geetha M [Syncfusion]
Replied On February 14, 2006 02:42 PM UTC

Hi Andi, We regret for the delayed response. Please try calling this.chartControl1.BeginUpdate(); and this.chartControl1.EndUpdate(); before and after adding the series respectively. This will let you to render the large number of points faster. I hope this helps you. Please let me know if you have any questions. Thanks and Regards, Geetha.

Administrator [Syncfusion]
Replied On February 15, 2006 09:33 AM UTC

Perfect! Thanks + Regards Andi

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;