Highcharts DateTime Localization

后端 未结 6 775
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 14:38

Can someone point me to how I can localize the date-related Strings which are hardcoded in the HighCharts js-file. For instance, instead of the default \'Feb\' date label in the

6条回答
  •  猫巷女王i
    2021-01-31 15:13

    And in German (note though that the mini-buttons in Highstocks are still labeled "YTD","1y", and "All") :

    Highcharts.setOptions({
                     lang: {
                         decimalPoint: ',',
                         thousandsSep: '.',
                         loading: 'Daten werden geladen...',
                         months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
                         weekdays: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
                         shortMonths: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
                         exportButtonTitle: "Exportieren",
                         printButtonTitle: "Drucken",
                         rangeSelectorFrom: "Von",
                         rangeSelectorTo: "Bis",
                         rangeSelectorZoom: "Zeitraum",
                         downloadPNG: 'Download als PNG-Bild',
                         downloadJPEG: 'Download als JPEG-Bild',
                         downloadPDF: 'Download als PDF-Dokument',
                         downloadSVG: 'Download als SVG-Bild',
                         resetZoom: "Zoom zurücksetzen",
                         resetZoomTitle: "Zoom zurücksetzen"
                           }
    });
    

    To change the range selector buttons, some more information is needed:

    rangeSelector: {
                  buttons: [{
                      count: 1,
                      type: 'month',
                      text: '1M'
                }, {
                      count: 5,
                      type: 'month',
                      text: '5M'
                }, {
                      type: 'all',
                      text: 'Alles'
                }],
                inputEnabled: false,
                selected: 0
            },
    
    month/months -> Monat/Monate  ("M" is the correct abbreviation)
    minute/minutes-> Minute/Minuten
    millisecond/milliseconds-> Millisekunde/Millisekunden
    year/years -> Jahr/Jahre
    all -> Alles (everything) or Gesamt (the whole)   
    ytd (year to date) -> seit Jahresbeginn (since the start of this year)
    

提交回复
热议问题