How to change the ShapeDefault in MVC dynamically?

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

    Posted 10 Feb Link to this post

    I'm using a diagram in ASP.Net MVC that is very similar to the example here. However, I need the ability to change the content in the shapes depending on options selected on the screen. So, for example, I have a checkbox on the screen that will turn the pictures on or off. The same could be done with, for example, the name or position. Is there any way that this could be done? 
  2. Tsvetina
    Admin
    Tsvetina avatar
    1931 posts

    Posted 14 Feb Link to this post

    Hello Geoff,

    You can dynamically trigger a redraw of the Diagram shapes and using if-statements in the shape visual function to determine whether or not to display some of the shape content:
    function visualTemplate(options) {
      var dataviz = kendo.dataviz;
      var g = new dataviz.diagram.Group();
      var dataItem = options.dataItem;
     
      if(showImages){
        g.append(new dataviz.diagram.Image({
          x: 3,
          y: 3,
          width: 68,
          height: 68
        }));
      }
      // ............

    You can see a sample here: http://dojo.telerik.com/@tsveti/ukUtu/4.

    You can also take a look at this article in the documentation, which elaborates on a similar scenario.

    Regards,
    Tsvetina
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top