Im adding chart series dynamically but i cant get any legends to shoiw on the graph. Ive tried all the methods in the api and help sections but nothing works (the suggestions just break the graph and nothing gets rendered) can anyone show me how to sad legends to dynamicallky added series ?
I define my chart in an MVC helper like this
@(Html.Infragistics().DataChart(Model.EnergyProductPriceMatrix) .ID("chart") .Width("100%") .Height("500px") .Axes(axis => { axis.CategoryX("DateAxis").Title("Date").Label(l => l.CloseDateAsString).Overlap(1.0).UseEnhancedIntervalManagement(true); axis.NumericY("PriceAxis").Title("Price (£/MWh)").LabelLocation(AxisLabelsLocation.OutsideLeft); }) .AnimateSeriesWhenAxisRangeChanges(true) .WindowScaleHorizontal(5.0) .WindowScaleVertical(5.0) .HorizontalZoomable(true) .VerticalZoomable(true) .WindowResponse(WindowResponse.Immediate) .ResponseDataKey("EnergyProductPriceMatrix") .Render() )
then I have some javascript that detects if a property on the model has a value, if it does, I create a series (I have multiple proiperties, one for each series i may or may not show)
this work and I render the appropriate series, but I dont get a legend ! this is driving me nuts and none of the suggestions work,
if (model.Series1EnergyProduct.length > 0) { $("#chart").igDataChart("option", "series", [{ name: model.Series1EnergyProduct, remove: true }]); $("#chart").igDataChart("option", "series", [{ type: "line", name: model.Series1EnergyProduct, title: model.Series1EnergyProduct, xAxis: "DateAxis", yAxis: "PriceAxis", valueMemberPath: model.Series1ValuePathName, isTransitionInEnabled: true, isHighlightingEnabled: true, thickness: 2, brush: "#E01512", showTooltip: true //legend: $("legend"), //labelMemberPath: model.Series1EnergyProduct //legendLabelMemberPath: model.Series1EnergyProduct }]); }
Hello Mark,
Thank you for contacting us.
Judging by your most recent cases, you managed to solve this issue? Can you confirm?
I am looking forward to hearing from you.