|
| 1 | +@page "/Charts/HideSelector" |
| 2 | +@using Syncfusion.EJ2.RazorComponents.Charts |
| 3 | +@using System; |
| 4 | +@using System.Collections.Generic; |
| 5 | +@using System.Linq; |
| 6 | +@using System.Threading.Tasks; |
| 7 | +@using Newtonsoft.Json; |
| 8 | +@*Hidden:Lines*@ |
| 9 | +@using ej2_blazor_samples |
| 10 | +@{ |
| 11 | + SampleBrowser.CurrentSampleName = SampleBrowser.Config.StockChart[1].Name; |
| 12 | + SampleBrowser.CurrentControlName = "StockChart"; |
| 13 | + SampleBrowser.CurrentControlCategory = "StockChart"; |
| 14 | + SampleBrowser.CurrentControl = SampleBrowser.Config.StockChart; |
| 15 | + SampleBrowser.ActionDescription = new string[] { |
| 16 | + @"<p> |
| 17 | + This sample visualizes stock chart without range Slider. |
| 18 | + </p>" |
| 19 | + }; |
| 20 | + SampleBrowser.Description = new string[] { |
| 21 | + @"<p> |
| 22 | + In this example, you can see how to render and configure the Stock chart. |
| 23 | + <code>LineSeries</code> is used to represent selected data value. |
| 24 | + </p> |
| 25 | + <br>" |
| 26 | + }; |
| 27 | +} |
| 28 | +@*End:Hidden*@ |
| 29 | + |
| 30 | +<div class="control-section"> |
| 31 | + <EjsStockChart id="stockChart" title="AAPL Stock Price" series="@seriesData" primaryXAxis="@xAxis" primaryYAxis="@yAxis" tooltip="@tooltip" dataSource="@data" enableSelector="false"> |
| 32 | + </EjsStockChart> |
| 33 | +</div> |
| 34 | + |
| 35 | +@functions{ |
| 36 | + |
| 37 | + public Object xAxis = new |
| 38 | + { |
| 39 | + valueType = "DateTime", |
| 40 | + labelFormat = "y", |
| 41 | + intervalType = "Years", |
| 42 | + edgelabelPalcement = "Shift", |
| 43 | + majorGridLines = new { width = 0.0000001 } |
| 44 | + }; |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + public Object yAxis = new |
| 49 | + { |
| 50 | + labelFormat = "{value}M", |
| 51 | + rangePadding = "None", |
| 52 | + title = "Revenue", |
| 53 | + majorTickLines = new { width = 0.000001 }, |
| 54 | + minorTickLines = new { width = 0.000001 } |
| 55 | + }; |
| 56 | + |
| 57 | + public Object tooltip = new |
| 58 | + { |
| 59 | + enable = false, |
| 60 | + shared = true |
| 61 | + }; |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + public Object crosshair = new |
| 66 | + { |
| 67 | + enable = false, |
| 68 | + lineType = "Vertical" |
| 69 | + }; |
| 70 | + |
| 71 | + public List<object> data { get; set; } = new List<object> { |
| 72 | + |
| 73 | + new LineChartData { xValue = new DateTime(2005, 01, 01), yValue = 21, yValue1 = 28 }, |
| 74 | + new LineChartData { xValue = new DateTime(2006, 01, 01), yValue = 24, yValue1 = 44 }, |
| 75 | + new LineChartData { xValue = new DateTime(2007, 01, 01), yValue = 36, yValue1 = 48 }, |
| 76 | + new LineChartData { xValue = new DateTime(2008, 01, 01), yValue = 38, yValue1 = 50 }, |
| 77 | + new LineChartData { xValue = new DateTime(2009, 01, 01), yValue = 54, yValue1 = 66 }, |
| 78 | + new LineChartData { xValue = new DateTime(2010, 01, 01), yValue = 57, yValue1 = 78 }, |
| 79 | + new LineChartData { xValue = new DateTime(2011, 01, 01), yValue = 70, yValue1 = 84 }, |
| 80 | + }; |
| 81 | + |
| 82 | + public class LineChartData |
| 83 | + { |
| 84 | + public DateTime xValue; |
| 85 | + public double yValue; |
| 86 | + public double yValue1; |
| 87 | + }; |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + public List<object> seriesData { get; set; } = new List<object> |
| 93 | + { |
| 94 | + new { xName = "xValue", type = "Line", yName = "yValue" } |
| 95 | + }; |
| 96 | + |
| 97 | +} |
0 commit comments