如何在chartjs上设置2个y轴标题(和/或标签)?

时间:2018-01-16 10:10:09

标签: javascript chart.js

我知道在chartjs图表上设置标题或标签只需要图表选项上的几个属性。

...
yAxes: [{
    scaleLabel: {
        display: true,
        labelString: "My Chart"
    }
}]
...

但是,无论如何在chartjs上设置2个标题/标签?我想添加一些副标题。

1 个答案:

答案 0 :(得分:1)

yAxis字幕没有选项,但您可以使用正确配置的辅助scales : { yAxes : [{ scaleLabel : { display : true, labelString : "subtitle", fontStyle : 'italic' } }, { display : true, gridLines : { display : false, color : 'transparent' }, ticks : { display : false }, scaleLabel : { display : true, labelString : "My Chart title", fontStyle : 'bold', fontSize : 14 } } ] }

SELECT    e.eventName, e.eventType, e.numberOfPersons, 
          (SELECT timeKey FROM StarSchema.dbo.timeDim WHERE (r.reservationDate = [DATE])) AS reservationDate,
          (SELECT timeKey FROM StarSchema.dbo.timeDim AS timeDim_2 WHERE (e.eventStartDate = [DATE])) AS eventStartDate,
          (SELECT timeKey FROM StarSchema.dbo.timeDim AS timeDim_1 WHERE (e.eventEndDate = [DATE])) AS eventEndDate,
          contact.name, customer.company, invoices.price, invoices.invoiceId
FROM      events AS e 
          INNER JOIN reservation AS r ON e.reservationId = r.reservationId 
          INNER JOIN customer ON e.customerId = customer.customerId 
          INNER JOIN contact ON customer.contactId = contact.contactId 
          INNER JOIN invoices ON e.invoiceId = invoices.invoiceId

检查这个小提琴:documentation

相关问题