Robert J.
Robert J.

Reputation: 2701

AppInsights > Logs > Render Bar Chart to start from 0

In my angular application I am tracking filters that users utilize on one of the pages. What I can later see in Logs, is the following (query for last 24 hours)

enter image description here

What I am interested in, is the count of filters groupped by its name. So I created the following query:

enter image description here

However the problem as you can see, is that my y-axis starts from 1 instead of 0. To users this looks like the last two filters don't have any values, where in reality they both have count of 1.

I have tried to use ymin=0 together with render function, however it did not work (chart still starts from 1). Then I have read I need to use make-series() function and so I tried:

customEvents
| where timestamp >= ago(24h) 
| where customDimensions.pageName == 'product'
| make-series Count=count(name) default=0 on timestamp from datetime(2019-10-10) to datetime(2019-10-11) step 1d by name
| project name, Count

However the result is some weird matrix instead of a regular table: enter image description here

I have just started with application insights thus any help in respect to this matter would be more than appreciated. Thank you

Upvotes: 1

Views: 1322

Answers (2)

JeanMarc
JeanMarc

Reputation: 326

A bit late to the party, but the correct syntax to pass in ymin and ymax when using a query is this:

| ...
| render barchart with (ymin=0, ymax=100)

See https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/renderoperator?pivots=azuremonitor

Upvotes: 0

John Gardner
John Gardner

Reputation: 25146

in Workbooks in application insights you could do almost this query (see below for a simplification?), then use the chart settings and set the axis min/max explicitly:

chart settings

but why are you using make-series but then summarizing to just one series?

in this specific case is summarize simpler:

customEvents
| where timestamp between(datetime(2019-10-10) .. datetime(2019-10-11))
| where customDimensions.pageName == 'product'
| summarize Count=count(name) by name
| render barchart

in the logs blade (where you are), you could do this query, and I believe you can use

render barchart title="blah" ymin=0

(at some point workbooks will be able to "see" all the rendeer options like ymin/ymax/xmin/xmax/title/etc, but right now they're all stripped out at service layer)

Upvotes: 1

Related Questions