<ejs-tab id="ej2Tab" heightAdjustMode="Fill">
<e-tab-tabitems>
<e-content-template>
<div>
<div class="e-tab-header">
<div>Line</div>
<div>Area</div>
<div>Column</div>
</div>
<div class="e-content">
<div>
<ejs-chart id="container">
//…
</ejs-chart>
</div>
<div>
<ejs-chart id="container1">
//…
</ejs-chart>
</div>
<div>
<ejs-chart id="container2">
//…
</ejs-chart>
</div>
</div>
</div>
</e-content-template>
</e-tab-tabitems>
</ejs-tab>
<script>
var chartParentDisplay;
function chartLoad(args) {
var parent = args.chart.element.parentElement;
chartParentDisplay = parent.style.display;
parent.style.display = (chartParentDisplay == "none") ? "block" : chartParentDisplay;
}
function chartLoaded(args) {
args.chart.element.parentElement.style.display = chartParentDisplay;
args.chart.loaded = null;
}
</script> |
Initial Line chart |
Navigating to Area Chart |
|
|
Index.cshtml
<ejs-tab id="ej2Tab" heightAdjustMode="Fill">
<e-tab-tabitems>
<e-tab-tabitem header="ViewBag.headerText0" content="#Chart1"></e-tab-tabitem>
<e-tab-tabitem header="ViewBag.headerText1" content="#Chart2"></e-tab-tabitem>
</e-tab-tabitems>
</ejs-tab>
<div id="Chart1" style="display:none">
<ejs-chart id="container">
//…
</ejs-chart>
</div>
<div id="Chart2" style="display:none">
<ejs-chart id="container1">
//…
</ejs-chart>
</div>
HomeController.cs
public IActionResult Index()
{
//…
ViewBag.headerText0 = new TabHeader { Text = "Line" };
ViewBag.headerText1 = new TabHeader { Text = "Column" };
ViewBag.dataSource = chartData;
return View();
} |
|
|