GM
Geetha M
Syncfusion Team
February 10, 2006 02:19 PM UTC
Hi Andi,
I am afraid that I am not able to reproduce the issue. Are you using any specific conditions for diaplaying the ContextMenu? If so could you please send me the code implementation part of it so that it will be easier to look into the cause of the problem?
Thanks and Regards,
Geetha.
AD
Administrator
Syncfusion Team
February 15, 2006 09:21 AM UTC
Hi Geetha,
it''s a tooltip issue. As soon as tooltips are enabled, I have the problem. You can reproduce the behaviour with the following source code (extention of F40628.zip).
What I need are tooltips for the data points. But as far as I know I just can enable tooltips for the whole chart. Is there a possibility to enable tooltips just for a series?
Regards
Andi
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;
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
///
/// 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.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
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.ContextMenu = this.contextMenu1;
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);
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.Text = "Context 1";
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.Text = "Context 2";
//
// 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;
this.chartControl1.ShowToolTips = true;
}
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; }
}
}
}
GM
Geetha M
Syncfusion Team
February 15, 2006 02:02 PM UTC
Hi Andi,
You can display customized tooltip by setting the PointsToolTipFormat of ChartSeries appropriately. Please refer the attached sample to get an elaborate idea about how to display customized tooltips.
SetToolTip.zip
Please let me know if this helps you.
Thanks and Regards,
Geetha.
AD
Administrator
Syncfusion Team
February 16, 2006 07:31 AM UTC
Hi Geetha,
thank you for the response. As soon as you set
this.chartControl1.ShowToolTips = true;
a context menu is not available anymore, when the tooltip is showing up.
Can I show tooltips for points without setting ShowToolTips = true?
That is because I want to show tooltips with information of the points, but I don''t use tooltips for the chart area.
Regards
Andi
GM
Geetha M
Syncfusion Team
February 17, 2006 12:59 PM UTC
Hi Andi,
I am able to reproduce the issue now (context menu does not appear). But I am afraid it is not possible to show tooltips without setting ShowToolTips = true. I will log a QA report on this and will let you know as soon as the bug is fixed.
Thanks for your continued support for Syncfusion products.
Regards,
Geetha