Your search did not match any results.

Charts - Zooming and Panning API

This example demonstrates how you can connect the Chart and RangeSelector components in order to zoom into the appropriate data range within the Chart. Move the sliders along the RangeSelector, and you will note that the value axis of the Chart is adjusted automatically.

Backend API
@using DevExtreme.AspNet.Mvc.Factories; @using DevExtreme.AspNet.Mvc.Builders; @functions { Action<CollectionFactory<ChartSeriesBuilder>> ConfigureSeries() { return (CollectionFactory<ChartSeriesBuilder> factory) => { factory.Add().ArgumentField("Arg").ValueField("Y1"); factory.Add().ArgumentField("Arg").ValueField("Y2"); factory.Add().ArgumentField("Arg").ValueField("Y3"); }; } } @(Html.DevExtreme().Chart() .ID("zoomedChart") .Palette(VizPalette.HarmonyLight) .CommonSeriesSettings(s => s.Point(p => p.Size(7))) .Series(ConfigureSeries()) .Legend(l => l.Visible(false)) .DataSource(Model) ) @(Html.DevExtreme().RangeSelector() .Size(s => s.Height(120)) .Margin(m => m.Left(10)) .Scale(s => s.MinorTickCount(1)) .Chart(c => c .Series(ConfigureSeries()) .Palette(VizPalette.HarmonyLight) ) .Behavior(b => b.ValueChangeMode(SliderValueChangeMode.OnHandleMove)) .OnValueChanged(@<text> function(e) { var zoomedChart = $("#zoomedChart").dxChart("instance"); zoomedChart.getArgumentAxis().visualRange(e.value); } </text>) .DataSource(Model) )
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.NETCore.Demos.Models; using DevExtreme.NETCore.Demos.Models.SampleData; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; namespace DevExtreme.NETCore.Demos.Controllers { public class ChartsController : Controller { public ActionResult ZoomingAndScrollingAPI() { return View(SampleData.PointsData); } } }
using System.Collections.Generic; namespace DevExtreme.NETCore.Demos.Models.SampleData { public partial class SampleData { public static readonly IEnumerable<object> PointsData = new[] { new { Arg = 10, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 20, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 40, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 50, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 60, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 75, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 80, Y1 = 30, Y2 = 50, Y3 = 13 }, new { Arg = 90, Y1 = 40, Y2 = 50, Y3 = 14 }, new { Arg = 100, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 105, Y1 = 40, Y2 = 175, Y3 = 120 }, new { Arg = 110, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 120, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 130, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 140, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 150, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 160, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 170, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 180, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 185, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 190, Y1 = 30, Y2 = 100, Y3 = 13 }, new { Arg = 200, Y1 = 40, Y2 = 110, Y3 = 14 }, new { Arg = 210, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 220, Y1 = 40, Y2 = 95, Y3 = 120 }, new { Arg = 230, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 240, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 255, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 270, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 280, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 290, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 295, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 300, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 310, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 320, Y1 = 30, Y2 = 100, Y3 = 13 }, new { Arg = 330, Y1 = 40, Y2 = 110, Y3 = 14 }, new { Arg = 340, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 350, Y1 = 40, Y2 = 95, Y3 = 120 }, new { Arg = 360, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 367, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 370, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 380, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 390, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 400, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 410, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 420, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 430, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 440, Y1 = 30, Y2 = 100, Y3 = 13 }, new { Arg = 450, Y1 = 40, Y2 = 110, Y3 = 14 }, new { Arg = 460, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 470, Y1 = 40, Y2 = 95, Y3 = 120 }, new { Arg = 480, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 490, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 500, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 510, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 520, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 530, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 540, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 550, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 555, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 560, Y1 = 30, Y2 = 100, Y3 = 13 }, new { Arg = 570, Y1 = 40, Y2 = 110, Y3 = 14 }, new { Arg = 580, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 590, Y1 = 40, Y2 = 95, Y3 = 12 }, new { Arg = 600, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 610, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 620, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 630, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 640, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 650, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 660, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 670, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 680, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 690, Y1 = 30, Y2 = 100, Y3 = 13 }, new { Arg = 700, Y1 = 40, Y2 = 110, Y3 = 14 }, new { Arg = 710, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 720, Y1 = 40, Y2 = 95, Y3 = 120 }, new { Arg = 730, Y1 = 20, Y2 = 190, Y3 = 130 }, new { Arg = 740, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 750, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 760, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 770, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 780, Y1 = -20, Y2 = 20, Y3 = 30 }, new { Arg = 790, Y1 = -39, Y2 = 50, Y3 = 19 }, new { Arg = 800, Y1 = -10, Y2 = 10, Y3 = 15 }, new { Arg = 810, Y1 = 10, Y2 = 10, Y3 = 15 }, new { Arg = 820, Y1 = 30, Y2 = 100, Y3 = 13 }, new { Arg = 830, Y1 = 40, Y2 = 110, Y3 = 14 }, new { Arg = 840, Y1 = 50, Y2 = 90, Y3 = 90 }, new { Arg = 850, Y1 = 40, Y2 = 95, Y3 = 120 }, new { Arg = 860, Y1 = -12, Y2 = 10, Y3 = 32 }, new { Arg = 870, Y1 = -32, Y2 = 30, Y3 = 12 }, new { Arg = 880, Y1 = -20, Y2 = 20, Y3 = 30 } }; } }