|
Zooming with limited passing parameters |
Posted by Bashir on Oct-06-2016 22:22 |
|
Hi Peter Kwan,
I am using Chart Director Version 5 as approved by our client.
Developing the graphs, data from SQL Server 2012 database and VS 2013.
By selecting the different columns from list box passing parameters to my query within stored procedure displaying the graphs in the chart director is working. I have issue with zooming, after certain number of passing parameters to the SQL query zooming throw error. I searched on Chart Director’s discussion forum and found that there are 256 bytes limit for passing query’s parameters and use WebChartViewer.setCustomAttr to overcome this issue.
My sample data is consist of 132 parameters and about 40 parameters are zoom able.
Could you please review my code in attached zipped folder, where I can use WebChartViewer.setCustomAttr in my code or any other way I can zoom the graphs by passing unlimited parameters to the SQL query?
Please help.
Thank you,
Bashir.
|
Re: Zooming with limited passing parameters |
Posted by Peter Kwan on Oct-07-2016 20:47 |
|
Hi Bashir,
If you encounter any error, please try to obtain the error message. If you run the code in Visual Studio, it should inform you which line is causing the error. However, you would need to remove the “try/catch” statement first. For your case, the “try/catch” does not seem to be able to fix the bug, but make it difficult to determine where is the bug. Also, please make sure you have enabled error reporting to the browser, so that you can see the detail error message on the browser.
If the error is due to the query parameters being too long, you can use custom attributes instead. It is like:
if (WebChartViewer.IsPartialUpdateRequest(Page))
{
WebChartViewer1.LoadViewerState();
processPartialUpdate(WebChartViewer1);
WebChartViewer1.PartialUpdateChart();
}
else if (IsPostBack)
{
processFullUpdate(WebChartViewer1);
}
else
{
// Store the parameters as the custom attribute "abc"
WebChartViewer1.setCustomAttr("abc", Request["ChannelNumbers"]);
createFirstChart(WebChartViewer1);
}
Then in drawChart, please get the parameter from the custom attribute, like:
// Get the channel numbers from the custom attribute
command.Parameters.AddWithValue("@channellist", WebChartViewer1.getCustomAttr("abc"));
Hope this can help.
Regards
Peter Kwan |
Re: Zooming with limited passing parameters |
Posted by Peter Kwan on Oct-07-2016 21:21 |
|
Hi Bashir,
One more thing I would like to add. Many browsers or web servers have a limit on query parameters as well. There is no standard for the length of the query parameters so every browsers or web servers may have a different limit. It can be something like 1K or 2K bytes. Note that this is not related to ChartDirector, but is a practical limit of the browsers and web servers.
You mentioned you can have "132 parameters". I can only find one query parameter "ChannelNumbers" in your code. If you really have a lot of query parameters, you may consider to use POST parameters instead of GET query parameters. That's why in my code, I do not use Request.Querystring but just use Request, as the latter can work for POST parameters as well.
Regards
Peter Kwan |
|