Posted 19 June 2019, 9:30 am EST
Hello,
We want to hide the grid lines inside the column/bar. So the grid lines would be visible throughout the chart but just hide in Column/bar area.
Please let me know how could we achieve that.
Thanks,
Parthiv
Forums Home / ComponentOne / WPF Edition
Posted by: digiptechnologies on 19 June 2019, 9:30 am EST
Posted 19 June 2019, 9:30 am EST
Hello,
We want to hide the grid lines inside the column/bar. So the grid lines would be visible throughout the chart but just hide in Column/bar area.
Please let me know how could we achieve that.
Thanks,
Parthiv
Posted 20 June 2019, 6:17 am EST
Hi Parthiv,
From what I understand, you wish to prevent the GridLines from rendering over the series data.
If that’s correct then I am researching more over it and discussing about the same with the developer [ID:385382]
Thanks,
Ruchir
Posted 20 June 2019, 7:25 am EST
Hello Ruchir,
Yes, that’s correct. Looking forward to hearing back from you.
Thanks,
Parthiv
Posted 8 July 2019, 8:05 am EST
Hello Ruchir,
Just checking in, if you have any update.
Thanks,
Parthiv
Posted 9 July 2019, 1:05 am EST
Hello Parthiv,
There are no updates on this as of now. I have asked the developer to share an update on this case?
I’ll get back to you as soon as there is some information.
Thanks,
Ruchir
Posted 21 August 2019, 6:58 am EST
Hi Parthiv,
To prevent grid lines from rendering over column/bar, it’s possible to move columns to the front after rendering the chart. For this, one should handle the Rendered event and inside invoke SetZIndex method, as follows:```
private void chart_Rendered(object sender, C1.WPF.Chart.RenderEventArgs e)
{
// find render canvas
var cnv = chart.FindFirstChild<C1.WPF.Chart.RenderCanvas>();
foreach (var item in cnv.Children)
{
var rect = item as System.Windows.Shapes.Rectangle;
if (rect != null)
{
// move to the front
Canvas.SetZIndex(rect, 1);
//Use opaque fill
rect.Fill = rect.Stroke;
}
}
}
[img]https://gccontent.blob.core.windows.net/forum-uploads/file-c9128779-4e6c-4f76-bf57-c488444b4cf2.png[/img]
[zip filename="ColumnChart.zip"]https://gccontent.blob.core.windows.net/forum-uploads/file-987e9460-51a9-430a-8308-05b62c8b7faf.zip[/zip]
Best wishes,
Ruchir
Posted 26 August 2019, 1:29 am EST
Hello Ruchir,
Thanks for the solution. But this is not working when I set the chart’s render mode to “Direct2D”.
Let me know how can we solve in that case.
Thanks,
Parthiv
Posted 27 August 2019, 3:21 am EST
Hi Parthiv,
I can see it happening at my end too.
The reason is, our code to set the ZIndex does not get triggered as the RenderCanvas has child of runtime type when RenderMode is set to Default2D.
So, I am re-discussing the case with the developer and will let you know as there is any information.
Thanks,
Ruchir
Posted 30 August 2019, 5:23 am EST
Hello Parthiv,
Developer has shared a solution that uses Chart’s Rendered and SymbolRendered events. The approach seems to be working, even with Direct2D RenderMode.
You’re requested to verify the same using the attached sample.
Best wishes,
Ruchir
ColumnChart-Direct2D.zip
Posted 2 September 2019, 5:47 am EST
Hi Ruchir,
Thanks for the reply. I have tried the solution you provided but not working.
I am getting “fld” as null in the below line.
var fld = chart.GetType().GetField(“_chartRenderer”, BindingFlags.Instance | BindingFlags.NonPublic);
Can you tell me why that can come to null or am I missing anything?
Thanks,
Parthiv
Posted 2 September 2019, 7:27 pm EST
Hello Ruchir,
Actually that has fixed the issue. We have the custom control which is derived from the C1FlexChart and hence I have to change the above code a little bit and that seems working now.
Thanks,
Parthiv
Posted 3 September 2019, 4:32 am EST
Hi Parthiv,
Thank you for confirming that the issue is resolved with the solution we shared.
Let us know, if you face any trouble in future.
Best regards,
Ruchir
Posted 10 September 2019, 4:32 am EST
Hi Ruchir,
Sorry to bother you again. The solution provided is working with bar and column charts but we have a chart with the type “Area” and this fix is not working for that.
I am attaching the sample project to highlight that.
Would you please review it and let me know what changes need to be made.
Thanks,
ParthivColumnChart.zip
Posted 12 September 2019, 7:04 am EST
Apologies Parthiv. I can observe that the workaround fails for Area type charts.
We are researching further to provide you a solution that works with Area type charts too. I’ll come back to you once we have a solution/workaround.
Thanks,
Ruchir
Posted 26 November 2019, 7:10 pm EST
Hello Ruchir,
Just checking in if there is any workaround or solution you found?
Thanks,
Parthiv
Posted 27 November 2019, 12:56 am EST
Hello Parthiv,
Currently, there are no workarounds available for Area type charts but the developer is investigating over it.
I will update you as soon as I receive some information.
Thanks,
Ruchir