HTMLChart Stacked Column Series with Items

4 posts, 0 answers
  1. Hani
    Hani avatar
    3 posts
    Member since:
    Jun 2012

    Posted 02 May 2015 Link to this post

    Hello,

     

    i have a project class with a list of employees assigned to each project

     

    what i want to achieve here is that i want the stacked column chart to display names of projects on X axis for each series then add each resource of this project to the series as a series item with Y-Value of the total hours consumed by this employee on this project which is also a property coming from ProjectResource Class, i do it this way

     

    Private Sub LoadAllProjects()

     dim Projects as new list(of Project)

     

    Projects = GetAllProjects()

    For Each nProject as Project in Projects

     Dim nSeries as new ColumnSeries

     Dim nAxisItem as new AxisItem

    nAxisItem.labelstring = nProject.Name

    nSeries.name = nProject.Name

    For Each nEmp as Employee in Project.Resources

     dim nItem as new SeriesItem

    nItem.Name = nEmp.Name

    nitem.yvalue = nEmp.TotalUtilized

    nSeries.Items.Add(nItem)

     

    Next

    RadHtmlChart1.PlotArea.Series.Add(nSeries)

    Next

    End Sub

     

    Using this the either all items get loaded into first series or they duplicate in each series, i have tried everything possible and its not working

     also the legend is display the project.names thats because im assigning Series.Name to Project.Name and i have to remove it but i need the legend to display the names of employees in each project

     

    Help is really appreciated, thanks

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 06 May 2015 Link to this post

    Hello Hani,

    I suggest providing a simple, locally runnable solution which recreates the same scenario with some dummy data source. With the sent code, it is hard to identify what is exactly the source, what data is bound, etc.

    Also, you cannot have different names for the Series Names and the labels in Legend.

    Regards,
    Ianko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hani
    Hani avatar
    3 posts
    Member since:
    Jun 2012

    Posted 06 May 2015 in reply to Ianko Link to this post

    HI,

    Thanks for your reply, I have simulated what i want with google charts and attaching a snapshot to the reply, basically i have a Projects and each Project has a list of Resources

    I load the projects list first then for each project i create a new series and name it to the project then for each project i loop through the list of resources and create a new seriesitem for each one and assign its value,

     

    Im not binding im using code behind to programmatically create everything so in order to create a chart similar to the one attached what should i do exactly? i didnt attach the entire project because basically the Project is a class with some properties and fields being populated from sql and each project class has a list of resource class which is also populated from code behind, finally we are getting a list of projects and a list of resources for each project

     

    thanks

     

  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 07 May 2015 Link to this post

    Hi Hani,

    Please find my suggestions and comments below:
        - From the provided snap shot I can suggest that you create 5 column series and 1 line series, each of them having 5 items for the 5 categories.  You can examine our demos in order to see how to configure series. The same property and tag names from the markup can also be used for the programmatic creation of the chart as well. You can see a programmatically created chart here - http://demos.telerik.com/aspnet-ajax/htmlchart/examples/serversideapi/programmaticcreation/defaultcs.aspx
        - You should use the new SeriesItems collection when creating the chart. More information is available here - http://www.telerik.com/help/aspnet-ajax/htmlchart-important-changes-regarding-the-series-declaration.html
       - You may also find useful the data source grouping code library, if your data is linear and you want to group it in separate fields for each series - http://www.telerik.com/support/code-library/group-radhtmlchart-data-source


    Regards,
    Danail Vasilev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top