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

how to show dates with fancytooltip

Thread ID:

Created:

Updated:

Platform:

Replies:

74318 Jun 6,2008 03:22 PM Oct 7,2013 02:20 AM Windows Forms 3
loading
Tags: Chart
anand
Asked On June 6, 2008 03:22 PM

i have a chart which is using a datattable to access the values x and y values. x values are dates. if i use fancy tool tip the date part comes up wierd. is there a special way to handle dates in sycnfusion for fancytooltip to display.


below is the src code for the chart
ChartSeries series = this._viewControl.Model.NewSeries("Time Line Chart");// , ChartSeriesType.StepLine);
ChartDataBindModel model = new ChartDataBindModel(ds, "dat1");
this._viewControl.model = model;
model.XName = "Date";
model.YNames = new string[] { "values" };
series.SeriesModelImpl = model;
series.Type = ChartSeriesType.StepLine;
this._viewControl.Indexed = false;
this._viewControl.Series.Add(series);
this._viewControl.PrimaryXAxis.DrawGrid = true; ;
this._viewControl.PrimaryYAxis.DrawGrid = true;
this._viewControl.PrimaryXAxis.AutoValueType = false;
this._viewControl.PrimaryXAxis.ValueType = ChartValueType.DateTime;
this._viewControl.PrimaryXAxis.DateTimeFormat = "MM/dd/yyyy";
this._viewControl.PrimaryXAxis.LabelIntersectAction = ChartLabelIntersectAction.MultipleRows;
//set Chart Axis Range
this._viewControl.ChartArea.PrimaryYAxis.RangeType = ChartAxisRangeType.Set;
this._viewControl.ChartArea.PrimaryYAxis.Range.Min = 0;
this._viewControl.ChartArea.PrimaryYAxis.Range.Max = 191875553;
this._viewControl.Legend.Visible = true;
this._viewControl.Series3D = true;
// The Primary Axes are set with DateTime values.
this._viewControl.PrimaryXAxis.IntervalType = ChartDateTimeIntervalType.Days;

// Avoids overlapping of Axes labels.
this._viewControl.PrimaryXAxis.LabelIntersectAction = ChartLabelIntersectAction.Rotate;
//information abt chart labels
this._viewControl.Text = "TIme Line Chart";
this._viewControl.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));

//zooming for chart
this._viewControl.EnableXZooming = true;
this._viewControl.ZoomFactorX = .5;
this._viewControl.EnableYZooming = true;
this._viewControl.ZoomFactorY = .5;
this._viewControl.HidePartialLabels = false;

// Display ToolBar

this._viewControl.ShowToolbar = true;
this._viewControl.ToolBar.DockingFree = true;

// Chart Area Tooltips
// this._viewControl.ShowToolTips = true;
//this._viewControl.ChartToolTip= "Chart Area";

// Series points Tooltips
//series.PointsToolTipFormat = "Notional:{{4}";
series.FancyToolTip.Visible = true;
series.FancyToolTip.Alignment = TabAlignment.Top;


//implement InteractiveCursor in a chart
// ChartInteractiveCursor Icursor = new ChartInteractiveCursor(_viewControl.Model.Series[0]);
//this._viewControl.ChartArea.InteractiveCursors.Add(Icursor);

// Set the range for the Axes.
DateTime date1;
date1 = DateTime.Now;
this._viewControl.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
this._viewControl.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(date1, date1.AddMonths(150), 15, ChartDateTimeIntervalType.Months);
//this._viewControl.PrimaryXAxis.DateTimeRange = new ChartDateTimeRange(date1, date1.AddYears(20), 1, ChartDateTimeIntervalType.Years);


J.Nagarajan [Syncfusion]
Replied On June 16, 2008 08:30 AM

Hi Warude ,

If your intention is to show the tooltip of DateTime values of X axis when hovering the series, then you have to handle ChartRegionMouseHover event and have to find the correct series value by getting corresponding Chart point from mouse coordinate. Then you have to display its using external tooltip. Please refer to the attached sample that demonstrates this completely.

http://help.syncfusion.com/samples/Chart.Windows/F74318/main.htm

Please let me know if this helps.

Thanks,
Nagaraj


Wen
Replied On July 16, 2013 08:36 PM

Hi,
   I have the same problem. I couldn't open the sample url. Can you provide me the new link to that sample? Thank you.


Best,
Wen

Anandaraj T [Syncfusion]
Replied On October 7, 2013 02:20 AM

Hi Wen,

Thanks for using Syncfusion products.

The sample url link is currently not available, so we have created a simple sample for displaying date time values in tooltip.

Please refer the following code snippet to achieve this:

<code>

[CS]

 

        void series_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)

        {

            ChartSeries series = sender as ChartSeries;

            args.Style.ToolTip = "XValue: " + series.Points[args.Index].DateX + "\nYValue: " + series.Points[args.Index].YValues[0];

        }

<code>

For more information about tooltip, please refer our online documentation in the following link:

ToolTip

Please let us know if you have any concern.

Regards,

Anand



FancyTooltip_d55a64b4.zip

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

;