Otá*_*ira 2 highcharts vue.js vuejs2 vue2-highcharts
我正在尝试使用 Vue2 对 highcharts 进行标准翻译,但我遇到了困难,因为我无法访问 setOptions 选项。我没有找到太多关于 vue2 和 Highcharts 的文档,所以我在使用它时遇到了一些困难,如果有人也可以向我提供这些内容,谢谢。
\n\nimport VueHighcharts from \'vue2-highcharts\'\nexport default{\n components: {\n VueHighcharts\n },\n props: [\'title\', \'subtitle\', \'initoptions\'],\n data(){\n let initOptions = JSON.parse(this.initoptions);\n let tmpSeries = [];\n let count = 0;\n\n $.each(initOptions, function(key, value) {\n let data = [];\n $.each(value, function(key2, value2){\n let date = key2.split(\'-\');\n data.push([Date.UTC(date[2], date[1], date[0]), value2]);\n });\n\n tmpSeries.push({\'name\': key, \'data\': data});\n count++;\n });\n\n return{\n options: {\n /* ***\n I can not set this setOptions property to lang\n *** */\n lang: {\n loading: \'Aguarde...\',\n months: [\'Janeiro\', \'Fevereiro\', \'Mar\xc3\xa7o\', \'Abril\', \'Maio\', \'Junho\', \'Julho\', \'Agosto\', \'Setembro\', \'Outubro\', \'Novembro\', \'Dezembro\'],\n weekdays: [\'Domingo\', \'Segunda\', \'Ter\xc3\xa7a\', \'Quarta\', \'Quinta\', \'Sexta\', \'S\xc3\xa1bado\'],\n shortMonths: [\'Jan\', \'Feb\', \'Mar\', \'Abr\', \'Maio\', \'Jun\', \'Jul\', \'Ago\', \'Set\', \'Out\', \'Nov\', \'Dez\'],\n exportButtonTitle: "Exportar",\n printButtonTitle: "Imprimir",\n rangeSelectorFrom: "De",\n rangeSelectorTo: "At\xc3\xa9",\n rangeSelectorZoom: "Periodo",\n downloadPNG: \'Download imagem PNG\',\n downloadJPEG: \'Download imagem JPEG\',\n downloadPDF: \'Download documento PDF\',\n downloadSVG: \'Download imagem SVG\'\n },\n chart: {\n type: \'spline\'\n },\n title: {\n text: this.title || \'\'\n },\n subtitle: {\n text: this.subtitle || \'\'\n },\n xAxis: {\n type: \'datetime\',\n dateTimeLabelFormats: {\n day:\'%e/%m\',\n week:\'%e/%m\',\n month: \'%m/%y\',\n year: \'%m\'\n },\n title: {\n text: \'Date\'\n }\n },\n yAxis: {\n title: {\n text: \'Total\'\n },\n labels: {\n formatter: function () {\n return this.value;\n }\n }\n },\n tooltip: {\n crosshairs: true,\n shared: true\n },\n credits: {\n enabled: false\n },\n plotOptions: {\n spline: {\n marker: {\n radius: 8,\n lineColor: \'#666666\',\n lineWidth: 1\n }\n }\n },\n series: tmpSeries\n }\n }\n }\n} \nRun Code Online (Sandbox Code Playgroud)\n\n我希望有人能帮助我,谢谢。
\n我不确定这个包,但使用官方 Vue Highcharts你可以设置这样的选项:
import Highcharts from 'highcharts';
import HighchartsMore from 'highcharts/highcharts-more';
HighchartsMore(Highcharts);
Highcharts.setOptions({
lang: {
decimalPoint: '.',
drillUpText: 'Back',
noData: "Check your options please",
resetZoom: 'Reset',
thousandsSep: ' '
}
});
import HighchartsVue from 'highcharts-vue';
Vue.use(HighchartsVue);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1426 次 |
| 最近记录: |