facioquo / stock-charts

This is a demo for use of the Skender.Stock.Indicators NuGet package. It is an Angular website with a .NET Web API for backend generation of indicators.
https://charts.StockIndicators.dev
Apache License 2.0
60 stars 21 forks source link

Add `chartjs-plugin-crosshair` after > v1.2.0 released with fixes #141

Open DaveSkender opened 2 years ago

DaveSkender commented 2 years ago

When upgrading to chart.js v3, the chartjs-plugin-crosshair plugin did not work. Subsequent upgrades to the plugin by the author (v1.2.0) did not seem to resolve all issues related to using Angular build with Typescript.

I have not been able to get it to work and suspect it would require substantial effort to workaround issues. Wait for further plugin updates before trying to re-implement.

Error: src/app/chart/chart.service.ts:36:21 - error TS2322: Type '{ title: { font: { family: string; }; display: false; }; legend: { display: false; }; tooltip: { enabled: true; mode: "index"; intersect: false; }; crosshair: any; }' is not assignable to type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry>>'.
  Object literal may only specify known properties, and 'crosshair' does not exist in type '_DeepPartialObject<PluginOptionsByType<keyof ChartTypeRegistry>>'.

 options: {
   plugins: {
      ...
      crosshair: {...}
   } }

  node_modules/chart.js/types/index.esm.d.ts:2717:3
    2717   plugins: PluginOptionsByType<TType>;
           ~~~~~~~
    The expected type comes from property 'plugins' which is declared here on type '_DeepPartialObject<CoreChartOptions<keyof ChartTypeRegistry> & ElementChartOptions<keyof ChartTypeRegistry> & PluginChartOptions<...> & DatasetChartOptions<...> & ScaleChartOptions<...>>'
DaveSkender commented 2 years ago

Not getting much support from the author of this plugin to fix anything. It does not work, even after overriding or adding missing typings.

DaveSkender commented 11 months ago

Whoa, a new release: https://github.com/AbelHeinsbroek/chartjs-plugin-crosshair/releases/tag/v2.0.0