-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Resizable
-
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
- Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Charts - SignalR Service
This example demonstrates a real-time data update in a financial candlestick chart bound to a SignalR server. Note that data used in this demo is for demonstration purposes only.
To integrate the Chart with a SignalR server, specify a CustomStore. Use the CustomStore's push(changes) method to insert, update, and remove data objects. This method accepts an array and allows you to update data in batches.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
@(Html.DevExtreme().Chart()
.ID("chart")
.Title("Stock Price")
.Series(s => {
s.Add()
.Type(SeriesType.Candlestick)
.ArgumentField("Date")
.Pane("Price")
.Aggregation(a =>
a.Enabled(true)
.Calculate((@<text>
function(e) {
var prices = e.data.map(function(i) { return i.Price; });
if(prices.length) {
return {
Date: new Date((e.intervalStart.valueOf() + e.intervalEnd.valueOf()) / 2),
open: prices[0],
high: Math.max.apply(null, prices),
low: Math.min.apply(null, prices),
close: prices[prices.length - 1]
};
}
}
</text>))
.Method(ChartSeriesAggregationMethod.Custom));
s.Add()
.Type(SeriesType.Bar)
.ArgumentField("Date")
.ValueField("Volume")
.Color("red")
.Pane("Volume")
.Name("Volume")
.Aggregation(a =>
a.Enabled(true)
.Method(ChartSeriesAggregationMethod.Sum));
})
.CustomizePoint((@<text>
function(arg) {
if(arg.seriesName === "Volume") {
var ohlc = $("#chart").dxChart("getAllSeries")[0].getPointsByArg(arg.argument)[0].data;
if(ohlc.close >= ohlc.open) {
return { color: "#1db2f5" };
}
}
}
</text>))
.Panes(p => {
p.Add().Name("Price");
p.Add().Name("Volume").Height(80);
})
.ArgumentAxis(a =>
a.ArgumentType(ChartDataType.DateTime)
.MinVisualRangeLength(l => l.Minutes(10))
.VisualRange(v => v.Length(VizTimeInterval.Hour))
)
.Legend(l => l.Visible(false))
.ValueAxis(v => v.Add().PlaceholderSize(50))
.Margin(m => m.Right(30))
.ScrollBar(s => s.Visible(true))
.LoadingIndicator(l => l.Enabled(true))
.ZoomAndPan(z => z.ArgumentAxis(ChartZoomAndPanMode.Both))
.Tooltip(t =>
t.Enabled(true)
.Shared(true)
.ArgumentFormat("shortDateShortTime")
.ContentTemplate(@<text>
<% var volume = points.filter(point => point.seriesName === 'Volume')[0]; %>
<% var prices = points.filter(point => point.seriesName !== 'Volume')[0]; %>
<div class='tooltip-template'>
<div><%- argumentText %></div>
<div>
<span>Open: </span>
<%- formatCurrency(prices.openValue) %>
</div>
<div>
<span>High: </span>
<%- formatCurrency(prices.highValue) %>
</div>
<div>
<span>Low: </span>
<%- formatCurrency(prices.lowValue) %>
</div>
<div>
<span>Close: </span>
<%- formatCurrency(prices.closeValue) %>
</div>
<div>
<span>Volume: </span>
<%- formatNumber(volume.value) %>
</div>
</div>
</text>)
)
.Crosshair(c => c.Enabled(true).HorizontalLine(hl => hl.Visible(false)))
)
<script src="~/Scripts/jquery.signalR-2.2.2.js"></script>
<script src="~/signalr/hubs"></script>
<script>
var formatCurrency = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format;
var formatNumber = new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }).format;
$(function () {
var hub = $.connection.stockTickDataHub;
var store = new DevExpress.data.CustomStore({
load: function () {
return hub.server.getAllData();
},
key: "Date"
});
hub.client.updateStockPrice = function (data) {
store.push([{ type: "insert", key: data.Date, data: data }]);
};
$.connection.hub.start({ waitForPageLoad: false }).done(function () {
$("#chart").dxChart({
dataSource: store
});
});
});
</script>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
To display updated data in real time, use the aggregation configuration object. In this object, set the enabled property to true, the method property to custom
, and then implement the calculate function to process the incoming data. In this demo, the calculate function aggregates data into a one point for each interval.
You can also use the contentTemplate function to update the tooltip content with incoming data.