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
1730
dynamic binding
posted

Hi,

I have multiple data series bound to igDataChart as follows:

@(Html.Infragistics().DataChart(Model.Data)
      .Axes((axes) =>
      {
            axes.NumericX("xAxis").Stroke("Black").StrokeThickness(4).MajorStroke("Whitesmoke");
            axes.NumericY("yAxis").Stroke("Black").StrokeThickness(4).MajorStroke("Whitesmoke");
       })
      .Series(series =>
      {
             series.ScatterLine("scatterSeries1", Model.DataSeries1)
               .XAxis("xAxis").YAxis("yAxis").MarkerBrush("Black")
               .XMemberPath(data => data.SpectralPoint)
               .YMemberPath(data => data.Wavelength)
               .ShowTooltip(true)
               .Thickness(5)
               .TooltipTemplate("tooltipTemplate");
        })
       .Series(series =>
       {
           series.ScatterLine("scatterSeries2", Model.DataSeries2)
           .XAxis("xAxis").YAxis("yAxis").MarkerBrush("Black")
           .XMemberPath(data => data.SpectralPoint)
           .YMemberPath(data => data.Wavelength)
           .ShowTooltip(true)
           .Thickness(5)
           .TooltipTemplate("tooltipTemplate");
        })
        .Series(series =>
        {
                 series.ScatterLine("scatterSeries3", Model.DataSeries3)
                 .XAxis("xAxis").YAxis("yAxis").MarkerBrush("Black")
                 .XMemberPath(data => data.SpectralPoint)
                 .YMemberPath(data => data.Wavelength)
                 .ShowTooltip(true)
                 .Thickness(5)
                 .TooltipTemplate("tooltipTemplate");
           })

        .DataBind()
        .Render()
)

Is there any way I can use loop to assign data series dynamically instead of assigning them one by one as I have shown above.

Parents
  • 1775
    Suggested Answer
    posted

    Hi, sanjaysutar

    There is no way to assign data series dynamically with an MVC helper since the MVC helper renders JavaScript code server side and it is executed only once before the web page is received by the user. Also, there is no way to assign multiple series in a loop to an igDataChart control with an MVC helper.

    You can satisfy both of these requirements if you use JavaScript to update a chart dynamically client side.

    Cheers, Lazar

Reply Children