Hide a SharePoint 2010 chart where there is no data (from a query string filter)

While I can get this functioanlity in Dundas chart by using it's code editor, but the SharePoint 2010 out-of-box Chart web part does not have the code editor and hence I can not post the code there.

Any way we can hide the chart web part if there are no data returned for it?

Please help.

Many Thanks,

Su

July 30th, 2015 8:23am

Hi Sushanta,

There is no OOB way to hide the chart web part when there is no data in the web part.

I recommend to use JavaScript object model to get the data source of the chart web part and then check if whether there is data after applying the query string filter for the data source.

If there is no data, then hide the web part programmatically.

If the data source is SharePoint list, you can refer to the link below about how to retrieve list items:

https://msdn.microsoft.com/en-us/library/office/hh185007%28v=office.14%29.aspx?f=255&MSPPError=-2147217396

Or you can create your own custom chart web part with the function that you need.

Thanks,

Victoria

Free Windows Admin Tool Kit Click here and download it now
July 31st, 2015 12:39am

Thanks Victoria.

Unfortunately I'm not into programming and hence looking any alternative way to do that.

Is there anyway I can put some code into the content editor webpart and by that I can hide a chart in runtime if there are no data being returned?

Many Thanks,
Sushanta

August 2nd, 2015 1:44am

Hi Sushanta,

Yes, you can add the content editor web part to the same page where the chart web part exists and then add the code to the content editor web part.

However, this is very complex.

So I recommend to create your custom chart web part to achieve this goal.

Thanks,

Victoria

Free Windows Admin Tool Kit Click here and download it now
August 2nd, 2015 10:26pm

Thanks Victoria.

Do you have the code piece, so that I can try plugging into my page using a content editor web part after updating the query string filters?

Many Thanks,

Sushanta

August 3rd, 2015 1:40am

Hi Sushanta,

The code should be based on the actual configuration and I have no such code in hand.

If the data source of the chart web part is SharePoint list, you can refer to the link below about how to retrieve list items:

https://msdn.microsoft.com/en-us/library/office/hh185007%28v=office.14%29.aspx?f=255&MSPPError=-2147217396

Thanks,

Victoria

Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2015 10:51pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics