Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Passing ViewData to Chart in ASP.NET MVC
posted

Hi,

how can I pass ViewData to a Chart in ASP.NET MVC? Should be somethig like

Chart.DataSource = ViewData["Data"] in the .aspx file.

 

Thanks!

Parents
  • 355
    posted

    Hi again,

    this works, but only in a UltraWebTab:

    <ig:WebTab ID="SalesVolumeTabs" runat="server" Height="260px" Width="200px">
            <Tabs>
             
                <ig:ContentTabItem runat="server" Text="Diagramm" >
                    <Template>
                        <%
                            SalesVolumeChart.DataSource = ViewData["SalesVolumeData"];
                            SalesVolumeChart.DataBind(); 
                        %>
                        <igchart:UltraChart ID="SalesVolumeChart" runat="server" 
                            DeploymentScenario-ImageURL="../Content/images/Chart.png" 
                            DeploymentScenario-FilePath="../../Content/images" 
                            EmptyChartText="Keine Daten vorhanden." ChartType="PieChart" Version="10.2" Height="240" Width="180" >
                        </igchart:UltraChart>
                    </Template>
                </ig:ContentTabItem>

            </Tabs>
         </ig:WebTab>

    I tried the same in the ExplorerBar (which was the first component to choose because of the linear alignment for mobile devices), but I always get Errors. Something like: <% %> tags can't be placed in the template section or that the component SalesVolumeChart is not known in the document.

    Is there a way to get this working in an ExplorerBar, so that the chart is show in a group section of the ExplorerBar?

    Thanks again, KurtJulius

Reply Children
No Data