Line chart with multiple points

2 posts, 0 answers
  1. Patrick
    Patrick avatar
    20 posts
    Member since:
    Aug 2013

    Posted 26 Aug 2013 Link to this post

    I have a class

    public class Event
    {
      public DateTime eventDate {get; set;}
      public string name {get; set;}
      public double eventvalue {get; set;}
    }
    And  a controller that returns a list of events.  I'm returning several events, but only one eventvalue and one date is showing up on the chart.


    <div class="chart-wrapper">
        @(Html.Kendo().Chart(Model)
            .Name("chart")
            .Title("events")
            .Legend(legend => legend
                .Position(ChartLegendPosition.Bottom)
            )
            .Series(series => {
            
                    series.Line(model => model.eventvalue )
                 .Name(item.name );
                 //.Labels(labels => labels.Format("{0:N0}").Visible(true));
           
            })
            .CategoryAxis(axis => axis
                .Categories(model => model.eventDate )
            )
            .ValueAxis(axis => axis.Numeric()
                .Labels(labels => labels.Format("{0:N0}"))
            )
        )
       
    </div>
    I've even tried this:
    <div class="chart-wrapper">
        @(Html.Kendo().Chart(Model)
            .Name("chart")
            .Title("Product Samplings")
            .Legend(legend => legend
                .Position(ChartLegendPosition.Bottom)
            )
            .Series(series => {
                foreach (var item in Model)
                {
                    series.Line(model => model.eventvalue )
                 .Name(item.name );
                 //.Labels(labels => labels.Format("{0:N0}").Visible(true));
                }
             
            })
            .CategoryAxis(axis => axis
                .Categories(model => model.eventDate )
            )
            .ValueAxis(axis => axis.Numeric()
                .Labels(labels => labels.Format("{0:N0}"))
            )
        )
      
    </div>

  2. Patrick
    Patrick avatar
    20 posts
    Member since:
    Aug 2013

    Posted 27 Aug 2013 Link to this post

    Well, I figured it out, but you'll have to pay me for the answer :)
Back to Top