Hi,
I have 2 charts on webpage, while they have no issue displaying the series but then the chart cannot be interacted: it cannot be zoom in, crosshair doesn't show when mouse hover over the chart area, and no tooltip is show when click on data point.Currently .NET Core project reference to IgniteUI 22.2.3 and Infragistics.Web.AspNetCore 6.22.2.7. Below is the code for the chart, the same code is use in old C# project that reference to old Infragistics library (forgot the actual version, should be around 2015's) and it works.
Chart.cshtml
using Infragistics.Web.Mvc @model SomeViewModel @(Html.Infragistics().Loader() .ScriptPath(Url.Content("~/js/IgniteUI/")) .CssPath(Url.Content("~/css/IgniteUI/")) .Theme("bootstrap") .Render()) @if (Model != null && Model.Measurements != null && Model.Measurements.Count() > 0) { @(Html.Infragistics().DataChart(Model.Measurements[0].StatData.AsQueryable()) .ID("ss_chart") .Width("95%") .Height("200px") .VerticalZoomable(true) .HorizontalZoomable(true) .CrosshairVisibility(Visibility.Visible) .Axes(axes => { axes.CategoryX("MessageTime").Label(d => d.MessageTimeString) .Interval(10).LabelVisibility(Visibility.Visible); axes.NumericY("SS").Title(Model.SignalStrengthChartLabel).MaximumValue(Model.SSChartYAxesMax).MinimumValue(Model.SSChartYAxesMin).FormatLabel("function (item) { return GetFormattedChartDecimalValue(item);}"); }) .Series(series => { for (int i = 0; i < Model.Measurements.Count; i++) { series.Line("Y_" + i, Model.Measurements[i].StatData.AsQueryable()) .XAxis("MessageTime") .YAxis("SS") .ValueMemberPath(d => d.SS) .ShowTooltip(true) .MarkerType(MarkerType.Circle) .Brush(Model.Measurements[i].Color) .MarkerBrush(Model.Measurements[i].Color) .TrendLineBrush(Model.Measurements[i].Color) .TooltipTemplate("ss_chart_tooltipTemplate") .Title(Model.Measurements[i].Name); } } ) .DataBind() .Render() ) } <script id="ss_chart_tooltipTemplate" type="text/x-jquery-tmpl"> <div style=""> <span>Cell : </span><span>${item.Name}</span><br/> <span>SS : </span><span>${item.SS}</span><br/> <span>Time : </span><span>${item.MessageTimeString}</span><br/> @*<span>Event : </span><span> <img class='infoPanelIcon' src='${item.Icon}' alt='' />*@ </span><br/> </div> </script>
Am I missing any configuration in the code, or do I need to reference to extra packages?
Hello and thank you for contacting Infragistics. I am currently investigating this and will get back to you shortly on this matter. In the meantime it would be greatly appreciated if you provide an isolated sample project demonstrating the behavior which will expedite this process. Let me know if you have any questions.
6177.Sample.zip
The crosshair's visibility can be set on the chart. As far as I know the DataChart never showed crosshairs or tooltips by default. In 22.2 we did add this to Category and Financial Chart.
eg.
chart.CrosshairVisibility = Visibility.Visible;
Please review and modify my sample demonstrating the tooltip issue.
Hello, yes, you were missing a reference to infragistics.dv.js in _Layout.cshtml.
<script src="~/js/IgniteUI/infragistics.dv.js"></script>
This is mentioned here:https://www.igniteui.com/help/getting-started
Let me know if you have any questions.
Thank you for pointing it out, it works after adding infragistics.dv.js. However, wouldn't the Infragistics Loader load all the necessary scripts whichever it sees fit? From documentation:https://www.igniteui.com/help/getting-started?_ga=2.244433282.666374193.1689824352-2080027568.1667657907#:~:text=Using%20Infragistics%20Loader%20%2D%20The%20Infragistics%20Loader%20is%20a%20loader%20that%20can%20automatically%20load%20Ignite%20UI%20for%20jQuery%20files%20(and%20not%20only).My chart is created using the loader.
Hello,
Please update your loader to include a resource to datachart.* :
Then you will not have to explicitlity call infragistics.dv
@(Html.Infragistics().Loader() .ScriptPath(Url.Content("~/js/IgniteUI/")) .CssPath(Url.Content("~/css/IgniteUI/")) .Theme("bootstrap") .Resources("igDataChart.*") .Render())
Thanks Michael!Can you point to me where in the documentation talks about all the Infragistics Loader and property (for example I did not know how to use "Resources" property)?
https://www.igniteui.com/help/using-infragistics-loader#resource-expressions
Scroll down to Loading All Resources