Stock Chart will display details about the points through tooltip, when the mouse is moved over the point.
By default, tooltip is not visible. Enable the tooltip by setting
enable
property to true .
<ejs-stockchart id="stockchart" load="stockload" title="AAPL Stock Price">
<e-stockchart-series-collection>
<e-stockchart-series type='Candle' xName="x"> </e-stockchart-series>
</e-stockchart-series-collection>
<e-stockchart-tooltipsettings enable="true"></e-stockchart-tooltipsettings>
</ejs-stockchart>
<script src="~/financial-data.js"></script>
<script>
var data = chartData;
function stockload(args) {
args.stockChart.series[0].dataSource = data;
}
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace EJ2CoreSampleBrowser.Controllers.StockChart
{
public partial class StockChartController : Controller
{
public IActionResult Default()
{
return View();
}
}
}
By default, tooltip shows information of x and y value in points. In addition to that, you can show more information in tooltip. For example the format ${series.name} ${point.x}
shows series name and point x value.
<ejs-stockchart id="stockchart" load="stockload" title="AAPL Stock Price">
<e-stockchart-series-collection>
<e-stockchart-series type='Candle' xName="x"> </e-stockchart-series>
</e-stockchart-series-collection>
<e-stockchart-tooltipsettings enable="true" header="Unemployment" format="<b>${point.x} : ${point.y}</b>"></e-stockchart-tooltipsettings>
</ejs-stockchart>
</div>
<script src="~/scripts/chart/financial-data.js"></script>
<script>
var data = chartData;
function stockload(args) {
args.stockChart.series[0].dataSource = data;
}
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace EJ2CoreSampleBrowser.Controllers.StockChart
{
public partial class StockChartController : Controller
{
public IActionResult Default()
{
return View();
}
}
}
The fill
and border
properties are used to customize the background color and border of the tooltip respectively. The textStyle
property in the tooltip is used to customize the font of the tooltip text.
<ejs-stockchart id="stockchart" load="stockload" title="AAPL Stock Price">
<e-stockchart-series-collection>
<e-stockchart-series type='Candle' xName="x"> </e-stockchart-series>
</e-stockchart-series-collection>
<e-stockchart-tooltipsettings enable="true" format="${point.x} : ${point.y}" fill="#7bb4eb">
</e-stockchart-tooltipsettings>
</ejs-stockchart>
<script src="~/scripts/chart/financial-data.js"></script>
<script>
var data = chartData;
function stockload(args) {
args.stockChart.series[0].dataSource = data;
args.stockChart.tooltip = {
border: {
width: 2,
color: 'grey'
}
};
}
</script>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace EJ2CoreSampleBrowser.Controllers.StockChart
{
public partial class StockChartController : Controller
{
public IActionResult Default()
{
return View();
}
}
}