JQuery-Flot:如何为y轴添加文本标签,为x轴添加日期标签?

时间:2023-01-12 20:16:52

So basically, I have a test graph in JQuery-Flot, and instead of the normal integer axis. I need to use text label for the Y-axis and date label for the X-axis. Do anyone know how to do this?

基本上,我有一个测试图在JQuery-Flot中,而不是正整数轴。我需要为y轴使用文本标签,为x轴使用日期标签。有人知道怎么做吗?

1 个解决方案

#1


9  

The flot api covers both of these cases (under "Customizing the axes"). For the x-axis you'll want to use the "time" option. For the y-axis tick labels you'll want to specify the ticks option (what text should appear at each location):

flot api涵盖了这两种情况(在“自定义轴”下)。对于x轴,您需要使用“time”选项。对于y轴标记标签,您需要指定滴答选项(每个位置应该出现什么文本):

ticks: [[0, "zero"], [1.2, "one mark"], [2.4, "two marks"]] 

#1


9  

The flot api covers both of these cases (under "Customizing the axes"). For the x-axis you'll want to use the "time" option. For the y-axis tick labels you'll want to specify the ticks option (what text should appear at each location):

flot api涵盖了这两种情况(在“自定义轴”下)。对于x轴,您需要使用“time”选项。对于y轴标记标签,您需要指定滴答选项(每个位置应该出现什么文本):

ticks: [[0, "zero"], [1.2, "one mark"], [2.4, "two marks"]]