Using the Mark Lines


#1

Hi community, I’d like to place mark lines on my bar charts. Testing with your sample ticket sales dataset, I’d like to place a line to show events with average commission greater than $130 for example. I came up with the code below but the mark lines don’t render. Please let me know what I’m doing wrong.

/* Configuration code for this widget */
let provider = cf.provider("Aktiun Elastic");
let source = provider.source('ticket_sales');
//Configuration for grid
let grid = cf.Grid().left(65).right(15).bottom(35).top(10);
// Define metrics
let metric0 = cf.Metric("commission","avg");
// Define attributes to group by
let group1 = cf.Attribute("eventname.keyword")
			.limit(10)
			.sort("desc",metric0);
// Add metrics and groups to data source
let myData = source.groupby(group1)
			.metrics(metric0);
// Define chart options
let myChart = myData.graph("Bars")
			.set("grid", grid)
			.set("markline", cf.MarkLine({name:'Value', yAxis:130}))
			.execute();

#2

hi @john the problem in your code is in the definition of the data related to the Mark Line, the correct way is the following:
cf.MarkLine().data([{name:'Value', yAxis:130}]))
You can see the Mark Lines article in the documentation for more information or let us know if you have more problems. Best regards.