Hi,
I have a Heatmap chart that I have customized so that each cell in the chart takes some predefined color. The issue is that the line common between two cells has double the color value (please see below image). Also I need to generate a border around the generated chart( area where the chart is drwan, not including the space for labels).
For coloring each cell, I have used the FillSceneGraph event as follows:
foreach (Primitive p in e.SceneGraph) { if (p.Path == "Border.Title.Grid.Chart") { p.PE.Fill = GetCustomColor(p.Row, p.Column); } }
Please see the image below describing the two issues.
Thanks in advance.
Hi Maya,
Thanks for the code and explaination. I could generate the borders using your code but still they are not smooth enough!. The X2 and Y2 axis has thinner borders than the other 2 axis.
I will mark your answer as verified though!.
Thanks a lot.
Hello sandy_joggy ,
I’m not sure which line you mean with this:” the white horizontal line is slightly more thick than the horizontal lines.” Could you elaborate on that?
Regarding the black border. It seems that there’s actually no lines there for the x2 and y2 axis. You can add them manually. I’ve prepared a sample for your reference.
Regarding the white space. It occurs due to the fact that the items inside the grid are of type box and when you outline them you outline the whole box and therefore a white line appears as an outline to the whole grid. If you’d like you could use this to your advantage and set the outline for the individual boxes to a Black to get a border but that would mean that you’d have to have the same color as a separator between the boxes and as an outline for the grid.
Let me know if i can be of further assistance.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Thanks a lot for the detailed description and code. It sure is step forward.
But still there are 2 niggles - the white horizontal line is slightly more thick than the horizontal lines. I dont know why its happening. And the black border is coming on only X and Y axis, and not on the X2 and Y2 axis. Also there seems to be some whitespace between the black border and the chart margins. Ideally I want StrokeWidth to be 1.
Thanks again for the help.
I’ve been looking into your issue and here’s what I’ve found out.
For the HeatMap chart the primitive that would be useful to you in your scenario would be the ones inside the Border.Title.Grid. These would be the primitives that will form the rectangles, lines and borders that will define the HeatMap. From those primitive to outline the chart you’ll need the primitives of type “Line” ( if (p.GetType().Name == "Line") ) and more specifically the ones that are solid (the DrawStyle is “Solid”). Set for those a stroke color to outline the whole grid and it’s width. For each rectangle you can also set a stroke that will outline it and will act as a border. To get those primitives just get those of type “Box”. Through them you can access also the row and column index so you should be able to paint the Stroke (outline) in any color similar to the way you paint the cells of the chart.
Here’s a code snippet of the modified FillSceneGraph event:
protected void UltraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
foreach (Primitive p in e.SceneGraph)
if (p.Path == "Border.Title.Grid.Chart")
p.PE.Fill = GetCustomColor(p.Row, p.Column);
p.PE.FillOpacity = 200;
}
if (p.Path != null && p.Path.Contains("Border.Title.Grid"))
if (p.GetType().Name == "Line")
if (((Infragistics.UltraChart.Core.Primitives.PrimitiveShape)(p)).lineStyle.DrawStyle.ToString() == Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Solid.ToString())
p.PE.Stroke = Color.Black;
p.PE.StrokeWidth = 2;
p.PE.StrokeOpacity = 200;
else if (p.GetType().Name == "Box")
//Here set the Stroke to your preferable border colour for the cells.
p.PE.Stroke = Color.White;
Also I’m attaching sample for your reference. Please let me know if you need further assistance with this or if you have any questions or concerns.
Hi Guys,
Please let me know if my two issues above are not clear or you need any more details on this.
And if its currently not possible to resolve the two issues, then also please confirm that.