This is a migrated thread and some comments may be shown as answers.

How to change the ShapeDefault in MVC dynamically?

1 Answer 72 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Geoff
Top achievements
Rank 1
Geoff asked on 10 Feb 2017, 06:05 PM
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? 

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 14 Feb 2017, 10:11 AM
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.
Tags
Diagram
Asked by
Geoff
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or