Skip to main content

Metrics

<metrics>
<metric
key="pct"
label="Percent"
valueFormat=".0%"
syntaxTemplate="pctin({entry.var},{entry.value})"
nKey="n"
/>
</metrics>

metric.key

Special, but explain why.

metric.label

Column name.

metric.valueFormat

A d3 format string. See d3 format.

metric.syntaxTemplate

The evaluator will replace keywords in brackets with attributes from entries or options that it crosses.

Recognized keywords and their non-intuitive mapping:

Template keywordAttribute replaced with
entry.*entry.*
option.*option.*
base.*(see node.base-selector)
Legacy keyword replacements
Template keywordAttribute replaced with
optionoption.value
entryentry.value
entry2entry.value2
entry3entry.value3
syntaxentry.syntax
filterentry.filter

metric.nKey

Determines whether to show weighted n ("wn") or unweighted n ("n"). If not provided, "wn" will be used.

Examples:

Standard percents

<metrics>
<metric
key="pct"
label="Percent"
valueFormat=".0%"
syntaxTemplate="pct({entry.syntax})"/>
</metrics>
<entries>
<entry syntax="q7==25" label="..." />
</entries>

Filtered percents

<metrics>
<metric
key="pct"
label="Percent"
valueFormat=".0%"
syntaxTemplate="pct(filter({entry.syntax},{entry.filter}))"/>
</metrics>
<entries>
<entry syntax="q7==25" filter="qhid==2" label="..." />
</entries>

SR matrix percents

<metrics>
<metric
key="pct"
label="Percent"
valueFormat=".0%"
syntaxTemplate="pctin({entry.value},{option.value})"/>
</metrics>
<optionSets>
<optionSet name="options1" label="Options">
<option value="1" label="Boy"/>
<option value="2" label="Girl"/>
<option value="3" label="Bought for myself"/>
<option value="4" label="Family"/>
</optionSet>
</optionSets>
<entries>
<entry value="Q13r1" label="..." />
<entry value="Q13r2" label="..." />
<entry value="Q13r3" label="..." />
<entry value="Q13r4" label="..." />
<entry value="Q13r5" label="..." />
</entries>