folkehelseinstituttet / Fhi.Frontend.Demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update the FHI AngularHighcharts API

proand opened this issue · comments

Description

API consumer gets confused when using the current FHI Angular Highcharts API because the naming is hard to understand and the behavior is inconsistent.

Acceptance Criteria

  1. Go to https://dev-designsystem.fhi.no/developer/components/highcharts
  2. Check that all diagrams works as before. There should be no changes at all!
  3. Go to FHI Angular Highcharts API
  4. Check that the docomuentation make sense and that
    • the interface is the same as the one below
    • all sub interfaces also are documented
    • all deprecated properties are still there, but marked for deprecation in later version

Supplementary information

NEW API interface (with more grouping):

export interface FhiDiagramOptions {
  activeDiagramType: FhiDiagramTypeIds;
  controls?: FhiDiagramControls;;
  footer?: FhiDiagramFooter;
  openSource?: boolean;
  series: Array<FhiDiagramSerie>;
  tableOrientation?: FhiTableOrientations;
  title: string;
  unit?: Array<FhiDiagramUnit>;

  // The followin will be deprecated in v5
  creditsHref?: string;
  creditsText?: string;
  decimals?: number;
  diagramTypeId?: FhiDiagramTypeIds;
  diagramTypeNavId?: keyof typeof DiagramTypeNavIds;
  diagramTypeSubset?: Array<FhiDiagramTypeIds>;
  disclaimer?: string;
  flags?: Array<FhiDiagramFlag>;
  lastUpdated?: string;
  mapTypeId?: keyof typeof MapTypeIds;
  metadataButton?: boolean;
  showFullScreenButton?: boolean;
}

All properties:

export interface FhiDiagramOptions {
  activeDiagramType: FhiDiagramTypeIds;
  controls?: {
    fullScreenButton?: {
      show?: boolean;
    };
    metadataButton?: {
      show?: boolean;
    };
    navigation?: {
      items?: {
        chartTypes?: Array<keyof typeof ChartTypeIds>;
        mapTypes?: Array<keyof typeof MapTypeIds>;
      };
      show?: boolean;
      type?: keyof typeof DiagramTypeNavIds;
    };
    tableOrientationButton?: {
      show?: boolean;
    };
  };
  footer?: {
    credits?: {
      href: string;
      text: string;
    };
    disclaimer?: string;
    flags?: Array<FhiDiagramFlag>;
    lastUpdated?: string;
  };
  openSource?: boolean;
  series: [
    {
      data: {
        name: string;
        y: number | string;
      };
      name: string | Array<string>;
      stack?: string;
      unitId?: number | string;
    },
  ];
  tableOrientation?: FhiTableOrientations;
  title: string;
  unit?: [
    {
      id: number | string;
      decimals: number;
      label: string;
      symbol: string;
      position: keyof typeof UnitSymbolPosition;
    },
  ];
}

Add console.warning "This "comp. prop" will be deprecated in v5, see https:// for more info.

Note to my self: check Fhi.Frontend.RnD #11 for more info

@yleaxeman Here are some of my earlier thoughts: 4efe3f8