new Trends()
Trends shows a line graph depicting the distribution of a word's occurrence across a corpus or document.
- Tutorials:
Example
let config = {
"chartType": null,
"docId": null,
"docIndex": null,
"labels": null,
"limit": null,
"mode": null,
"query": null,
"stopList": null,
"withDistributions": null
};
loadCorpus("austen").tool("Trends", config);
Members
-
bins
-
Properties:
Name Type Description Thebins default value will depend on the nature of the corpus:
- corpus has one document: the default number of bins is 10
- corpus has multiple documents:
- corpus has up to 100 documents: the default number is the size of the corpus
- corpus has more than 1000 documents: the default number is 100
-
chartType
-
Properties:
Name Type Default Description chartTypeString barline The of chart to display: Options are: 'area', 'bar', 'line', 'stacked', and 'barline'.
-
docId
-
Properties:
Name Type Description docIdString | Array.<String> The document ID(s) to restrict the results to.
-
docIndex
-
Properties:
Name Type Description docIndexNumber | Array.<Number> The document index(es) to restrict the results to.
-
height
-
Properties:
Name Type Description heightNumber The display height of the tool in pixels. -
labels
-
Properties:
Name Type Default Description labelsBoolean false Whether to show term labels.
-
limit
-
Properties:
Name Type Default Description limitNumber 5 The number of items to limit the result to.
-
mode
-
Properties:
Name Type Default Description modeString corpus Force the mode to be either "corpus" (distribution of terms across documents) or "document" (distribution of terms within a document); usually this is correctly set by default according to whether the corpus has one document ("document") or more than one ("corpus").
-
query
-
Properties:
Name Type Description queryString | Array.<String> A query or array of queries (queries can be separated by a comma). For query syntax, see the search documentation.
-
stopList
-
Properties:
Name Type Default Description stopListString auto A comma-separated list of words, a named list or a URL to a plain text list, one word per line. By default this is set to 'auto' which auto-detects the document's language and loads an appropriate list (if available for that language). Set this to blank to not use the default stopList. For more information see the Stopwords documentation.
-
style
-
Properties:
Name Type Description styleString A string of CSS properties to use as the style attribute for the tool's parent tag. -
width
-
Properties:
Name Type Description widthNumber The display width of the tool in pixels. -
withDistributions
-
Properties:
Name Type Default Description withDistributionsString relative Determines whether to show "raw" or "relative" frequencies (those are the two valid values). The default value is "relative" (unless there's only one document in the corpus, in which case raw frequencies are shown).