How to make Html NThinChartControl responsive


https://www.nevron.com/Forum/Topic11972.aspx
Print Topic | Close Window

By mouloud djamah - 8 Years Ago
Hi
How to make Html NThinChartControl responsive 
Using NThinChartControl component, the following Html is generating in the internet explorer :

<div id='NDataZoomToolExample' style='margin:0;padding:0;overflow:visible;position:relative;font-size:0px;width:400px;height:400px'><script type='text/javascript'>{var host = NClientNode.GetFromHtmlElement($("div[id = 'NDataZoomToolExample']")[0]);if (host == null) {
host = new NClientHost($("div[id = 'NDataZoomToolExample']")[0],"/NDataZoomToolExample/Service","",new NChartCommandProcessor(),new NRect(0, 0, 400, 399));;
var request = NRequest.GetUpdateScriptRequest();
host.ExecuteServiceRequest(request);
}
}</script></div>
                              
I am trying to make the NThinChartControl responsive by using the following javascript code:
<script>
    $(window).resize(function() {
        var element = document.getElementById("NDataZoomToolExample");
        if (element == null) return;
        element.style.width = "100%";
        element.style.height = "100%";
    });
</script>

But the NThinChartControl does not resize and the attribute values (of width and heigth) of html <div id='NDataZoomToolExample'> element don’t change.

Remark: The sample mvc project provided by Nevron has the same problem. The size of Html NThinChartControl doesn’t change. 
By Nevron Support - 8 Years Ago
Hi Mouloud,
You cannot make the control responsive by resizing the client host div - the control will also have to update the size on the server and regenerate the chart image accordingly. We'll consider adding this feature in future releases.