/liregression

Linear Regression Panel made for Grafana . The algorithm for making the result of regression is not deep learning but mathematical calculation.

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Linear Regression Plugin for Grafana

스크린샷 2020-07-21 04 42 43

This panel draw forcaset result of selected target data by linear regression.

Main Issues

  1. @types/d3 doesn't support enough type to use d3's library on Grafana
  2. so I change some type as any type

where : @type/d3 -> d3-array -> index.d.ts
how : insert 'any type' in max interface

  1. In the end, adove one is not able to pass CircleCI pipline test
  2. So I changed my code as any type to pass it
  3. CircleCI reinstalls all dependencies and test your code with strong prettier and lint rules
  4. I recommend you to check your code in CircleCI when you do pull request to grafana plugin repository.

Development

Using Docker:

  1. Clone the repository and cd to it
  2. make sure you have yarn installed
  3. install project dependencies: yarn install --pure-lockfile
  4. Start the "watch" task: yarn watch
  5. Run a local Grafana instance with the development version of the plugin: docker run -p 3000:3000 -d --name grafana-plugin-dev --volume $(pwd)/dist:/var/lib/grafana/plugins/clock-panel grafana/grafana
  6. Check the logs to see that Grafana has started up: docker logs -f grafana-plugin-dev
  7. Open Grafana at http://localhost:3000/
  8. Log in with username "admin" and password "admin"
  9. Create new dashboard and add the plugin

To build a production build with minification: yarn build

check grafana plugin tutorial

https://grafana.com/tutorials/build-a-panel-plugin-with-d3/#8

Screenshots

스크린샷 2020-07-21 04 42 52 스크린샷 2020-07-21 04 43 17

스크린샷 2020-05-25 23 54 50 스크린샷 2020-05-25 23 54 50 스크린샷 2020-05-25 23 55 02 스크린샷 2020-05-25 23 55 19 스크린샷 2020-05-25 23 56 23 스크린샷 2020-05-25 23 56 36

pull request 시 참고사항

  1. CircleCI pipline 을 통해서 코딩 규칙 테스트 완료후 진행
  2. pull request 는 github.com 온라인 페이지에서 진행
  3. bellow is a image for how to do pull request to Grafana plugin 스크린샷 2020-07-22 05 45 01

individual part

d3-array -> index.d.ts 관련부분

export function max(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => any | string | undefined | null): any | string | undefined; export function min(array: ArrayLike, accessor: (datum: T, index: number, array: ArrayLike) => any | string | undefined | null): any | string | undefined;

package.json 부분

"dependencies": { "@types/d3": "^5.7.2", "@types/d3-array": "file:MyModule/d3-array" }, "resolutions": { "@types/d3-array": "1.2.7" }