ChartJS dataset Hidden property

0
0

Hi,

I need to know if a user has hidden one o more dataset. ChartJS.Dataset(x).Hidden property return always False

is there a way to get this information?

best

Cristian

  • You must to post comments
0
0

Hi Levie,

try with barchart with your example: https://docs.wisej.com/examples/examples/chartjs

I’m not eable to know if the dataset is hidden or not

best

Cristian

  • Levie (ITG)
    Hi Cristian, you probably have the wrong context. You can get the widget’s context on the client-side by calling “widget(‘id_xxx’)” where xxx is the ID of the widget. You can retrieve the Id of the control by using this on the server: “((Wisej.Core.IWisejControl)this.chartJS1).Id”. Alternatively, you can use something like “App.MainPage.flowLayoutPanel1.chartJS1 ” in JavaScript to get the context of the ChartJS control. HTH, Levie
  • Levie (ITG)
  • Cristian Zerbinati
    Hi Levie, the context is right, but I have just found the solution: var isHidden = await this.chartJS1.EvalAsync(“this.chart.isDatasetVisible(0)”);
  • You must to post comments
0
0

Hi Cristian,

can you please wrap up a small test case so we can see why it fails for you?

Thanks in advance!

Best regards
Frank

  • You must to post comments
0
0

No way? 🙁

  • You must to post comments
0
0

I have try this.chart.data.datasets[0].hidden

don’t return error, but return always false

  • You must to post comments
0
0

Sorry Levie, I have an error: : ‘this.widget is undefined’

 

 

  • You must to post comments
0
0

You can check the hidden status of the client-side widget’s dataset using this:

var isHidden = await this.chartJS1.EvalAsync("this.widget.data.datasets[0].hidden");
 AlertBox.Show($"Hidden Status from Client: {isHidden}");

HTH,

Levie

  • You must to post comments
0
0

Hi Levie,

sorry for my late reply, the notification email don’t arrives.

your code works, but I need to know it the user has hidden the dataset client side

best

  • You must to post comments
0
0

Hi Cristian,

I just tried with this and it seems to work correctly. Can you attach a small sample?

private void button1_Click(object sender, EventArgs e)
 {
 this.chartJS2.DataSets[0].Hidden = !this.chartJS2.DataSets[0].Hidden;
 AlertBox.Show(this.chartJS2.DataSets[0].Hidden.ToString());
 this.chartJS2.Update();
 }

 

Thanks!

Levie

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.