Posted 10 January 2021, 8:51 pm EST
Hello, I am using c1 FlexPie! I would like to know if there’s a way to clear the FlexPie every two minutes to contact the MSSQL!
Forums Home / ComponentOne / General Discussion
Posted by: duwhd791 on 10 January 2021, 8:51 pm EST
Posted 10 January 2021, 8:51 pm EST
Hello, I am using c1 FlexPie! I would like to know if there’s a way to clear the FlexPie every two minutes to contact the MSSQL!
Posted 11 January 2021, 9:13 pm EST
Hi,
You can call FlexPie’s ResetDataSource method or you can also set FlexPie’s DataSource property to null in order to clear the FlexPie.
And regarding contacting MSSQL at specific time intervals, you can use Timer class.
Please refer to the attached sample which updates FlexPie each second. (see FlexPieSample.zip)
Regards,
Kartik
Posted 12 January 2021, 11:18 am EST
Thank you, Kartik. I would like to ask you one more question.
I’m using six FlexPie.
If I didn’t use ResetDataSource, could I have the program shut down if I left it on all day?
Please help me.
The program will continue to shut down…
Posted 12 January 2021, 4:57 pm EST
Hi,
If I didn’t use ResetDataSource
Does that mean you are adding to existing DataSource? If that’s the case then your application might be going out of memory. Therefore, I would recommend you to reset the data source on each time interval.
Just in case required, you may also look at the stack trace regarding the failure information.
In case you are getting an error message other than out of memory then I would request you to share a stripped down sample replicating the behavior.
Regards,
Kartik
Posted 13 January 2021, 2:53 pm EST
Thank you, Kartik.
The modified source.
As you said, we used ResetDataSource, but the program will be shut down.
Should I also reset the list of pallets? Then can you tell me the code?
What’s the problem?
[b] Dim plan_qtyP10 As Integer = dsP10.Tables(0).Rows(0)“plan_qty”).ToString()
Dim job_qtyP10 As Integer = dsP10.Tables(0).Rows(0)(“job_qty”).ToString()
FlexPie_P10.ResetDataSource() '>>======Modified Row======<<
FlexPie_P10.Binding = "qty" FlexPie_P10.InnerRadius = 0.7 FlexPie_P10.StartAngle = 90 FlexPie_P10.Reversed = True FlexPie_P10.DataLabel.Position = C1.Chart.PieLabelPosition.Center FlexPie_P10.CustomPalette = New List(Of Brush)() From { Brushes.Gray, Brushes.DeepSkyBlue } FlexPie_P10.Palette = C1.Chart.Palette.Custom Dim datap10 As List(Of Object) = New List(Of [Object])() datap10.Clear() datap10.Add(New With { .name = "", .qty = plan_qtyP10 - job_qtyP10 }) datap10.Add(New With { .name = "job_qty", .qty = job_qtyP10 }) FlexPie_P10.DataSource = datap10[/b]
'use Timer1_Tick event >> option interval 120000
Posted 13 January 2021, 4:45 pm EST
Hi,
Thank you for sharing the sample code.
I am not able to reproduce this behavior at my end. However, the code looks fine and resetting palette is not required. Could you please share the error you are getting and the C1 version are using?
I would also request you to share a sample replicating the issue along with the steps to reproduce the issue so that I can assist you accordingly.
Regards,
Kartik
Posted 14 January 2021, 5:14 pm EST
Thank you, Kartik.
Thank you for your kind response every time.
I’ll just ask one last question.
Is there a problem with the window timer setting?
This code is in use.
[b]Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
Me.Invoke(
New EventHandler(Sub()
Search_Rtn()
End Sub))
Catch ex As Exception
End Try[/b]
P.S. Currently, version C1 is using version 4.5.2.
Posted 14 January 2021, 5:46 pm EST
Hi,
This code snippet is also working fine at my end. Could you please share the sample replicating the issue so that I can investigate the issue at my end?
Regards,
Kartik