Seal Report Forum
»
General
»
General Discussions/Other
»
Is it possible to access non-serie data through custom template text?
Rank: Newbie
Groups: Registered
Joined: 10/16/2020(UTC) Posts: 1
|
I have a plotly chart showing a simple scatterplot, I'd just like to add more info to the label on hover. For simplicity, lets say I have columns for Date, Value, and Description. I'm plotting Date and Value as my x and y, but I'd like to have the Description display on hover ONLY (i.e. not using it as a splitter, axis, or plotted serie). It was easy enough to customize the template to display hardcoded dummy "descriptions", but my C# isn't great and I just can't seem to actually access the Description column data without plotting it.
So is there a way to access a column in the model that isn't explicitly a serie and get it's values into something resembling the ChartYSerieValues string? Or alternatively, to make it a serie but not plot it?
Thanks!
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
I made a report to handle your requirement...just to display the last name in the chart. based on https://plotly.com/javas...ver-text-and-formatting/In a custom template of the Plotly View, create a text values string that will be the list of label descriptions: Code: var textValues = "";
foreach (var xv in page.ChartXLabels.Split(',')) {
//find the row in the ResultTable
var desc = "";
foreach (System.Data.DataRow dr in reportModel.ResultTable.Rows) {
if (dr["C0"].ToString() == xv.Replace("'","")) {
desc = dr["C1"].ToString();
break;
}
}
if (textValues.Length != 0) { textValues += ","; }
textValues += Helper.QuoteSingle(System.Web.HttpUtility.JavaScriptStringEncode(desc));
}
Note that C0 or C1 are the columns defined in the model (View SQL from the model). Then inject it in the chart: Code: marker: { color: @Raw(color) },
text: [@Raw(textValues)]
},
</text>
The full example is here: custom plotly label.srex (15kb) downloaded 3 time(s).Edited by user Monday, July 5, 2021 12:22:15 PM(UTC)
| Reason: Not specified
|
|
|
|
Seal Report Forum
»
General
»
General Discussions/Other
»
Is it possible to access non-serie data through custom template text?
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.