Hi,
I have tried to provide a tool tip in legend area on mouse move event and it was created in the fillscenegraph event.
Also, the selection of the chart type is "Line Chart" and the application platform is .Net Framework 3.5 & Infragistics version is 2009.1
Below code is used to customize the legend area,
private Primitive LastPrimitive { get; set; } void UltraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e) { PrimitiveCollection primitivesToAdd = new PrimitiveCollection(); foreach (Primitive p in e.SceneGraph) { if (p.Path != null && p.Path.Contains("Legend")) { p.Layer = e.ChartCore.GetChartLayer(); if (p is Box) { this.LastPrimitive = p; } else if (p is Text) { Text t = (Text)p; p.Row = 0; p.Column = 0; p.Value = this.LastPrimitive.Value; Box newBox = new Box(t.bounds); newBox.PE.FillOpacity = newBox.PE.StrokeOpacity = 0; newBox.Row = p.Row; newBox.Column = p.Column; newBox.Chart = p.Chart; newBox.Layer = p.Layer; newBox.Value = p.Value; newBox.Caps = PCaps.HitTest | PCaps.Skin | PCaps.Tooltip; primitivesToAdd.Add(newBox); } } } e.SceneGraph.AddRange(primitivesToAdd.ToArray()); }
When the mouse moves on legend area, the tool tip displays without issues and if the scrollbar is disabled.
But, the same is not displaying on while setting the property EnableScrollbar = true.
Please assist us to overcome from this issue.
Thanks in advance and hope will wait for the quick response.
Best regards,
Rithanya
Hello Rithanya,
There are differenet approaches to solve this task. One possible approach could be if you are using FillSceneGraph and MouseMove events. For example:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ legendItems.Clear(); foreach (Primitive p in e.SceneGraph) { if (p is Box && p.Path != null && p.Path.ToLower().IndexOf("legend") != -1 && p.Row != -1 && p.Column != -1) { legendItems.Add(p as Box); } }}
private void ultraChart1_MouseMove(object sender, MouseEventArgs e){ if (legendItems.Where(p => p.rect.X < e.Location.X && e.Location.X < p.rect.X + p.rect.Width && p.rect.Y < e.Location.Y && p.rect.Y + p.rect.Height > e.Location.Y).Count() > 0) { Box it = legendItems.Where(p => p.rect.X < e.Location.X && e.Location.X < p.rect.X + p.rect.Width && p.rect.Y < e.Location.Y && p.rect.Y + p.rect.Height > e.Location.Y).First(); if (it != null) { int index = legendItems.IndexOf(it); Graphics gr = ultraChart1.CreateGraphics(); gr.DrawRectangle(new Pen(Brushes.Black), new Rectangle(it.rect.X + 9, it.rect.Y - 11, 22, 16)); gr.FillRectangle(Brushes.WhiteSmoke, new Rectangle(it.rect.X + 10, it.rect.Y - 10, 20, 15)); gr.DrawString(dt.Rows[index].Field<Decimal>(1).ToString(), new System.Drawing.Font("Ariel", 8F), Brushes.Black, new PointF(it.rect.X + 10, it.rect.Y - 10)); } } else { ultraChart1.Refresh(); }}
Please take a look at the attached sample and video file for more details. Let me know if you have any questions.
Regards
HiGeorgi,
Thanks for the reply.
Let me check and update you.
Rithanya.
Hi Georgi,
Thanks for the sample.
I have checked that the sample file is releated to the ultrawinchart control. But, we are facing this issue on ultrawebchart control & the infragistics version is
"Infragistics35.WebUI.UltraWebListbar.v9.1".
So, could you please provide the sample on this and let me know the same concept will works on web chart(on mouse over event)?
Sorry, we are using the ultrawebchart control version is "Infragistics35.WebUI.UltraWebChart.v9.1".
Best Regards,
Hello
Thanks for the info. Please use the code below in your FillSceneGraph event:
private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ PrimitiveCollection PrimitiveList = new PrimitiveCollection(); foreach (Primitive p in e.SceneGraph) { if (p is Box && p.Path != null && p.Path.ToLower().IndexOf("legend") != -1 && p.Row != -1 && p.Column != -1 ) { Box newBox = new Box(new Rectangle(((Box)p).rect.X, ((Box)p).rect.Y, ((Box)p).rect.Width, ((Box)p).rect.Height)); newBox.PE.FillOpacity = newBox.PE.StrokeOpacity = 0; newBox.Row = p.Row; newBox.Column = p.Column; newBox.Chart = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart; newBox.Caps = PCaps.HitTest | PCaps.Skin | PCaps.Tooltip; PrimitiveList.Add(newBox); } } e.SceneGraph.AddRange(PrimitiveList.ToArray());}
Please note that you should specify newBox.Chart property, depending of your chart type. In your scenario with Line chart you should use:
newBox.Chart = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart;
If you want to specify the data in your tooltip, you should use both properties:
newBox.Row = p.Row;
newBox.Column = p.Column;
to specify which value from your datasource to be shown.
Let me know if you have any questions.
Thanks for the sample code.
Let me try it and get back you.
Thanks for the info. Let me know if you have any questions.
If you need any additional assistance feel free to write us.
After some research, the "Ability" has been determined to be a new product idea. I have sent your idea directly to our product management team. Our product team chooses new ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time. Your reference number for this product idea is PI13030074.If you would like to follow up on your request at a later point, you may contact Developer Support management via email. Please include the reference number of your product idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.comThank you for your request.
I have tried with your sample code. But our expectation is not reached to view the tool tip on mouse over in leegned area with the chart scroll bar option is enabled(EnableScrollbar = true).
Please refer the attached sample file on this.
Thanks for the replies.