azure-sdk-for-js
azure-sdk-for-js copied to clipboard
Update Anomaly Detector README.md to fix sample code bug
Running the code as-is results in the following error:
The sample encountered an error: TypeError: Cannot read properties of undefined (reading 'daily')
at main (C:\myapp\test4.js:31:34)
at Object.<anonymous> (C:\myapp\test4.js:53:1)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Proposed change fixes this issue and results in the expected output of:
Change points were detected from the series at index:
9
Alternate solution:
Replace 2 references of TimeGranularity
in line 103 and 133 with KnownTimeGranularity
. Then granularity: KnownTimeGranularity.daily
in line 133 will work