找到你要的答案

Q:Displaying jquery graph data according to date

Q:根据日期显示数据的jQuery图

I am using jQuery flot for plotting graphs in my PHP page. My page retrieves data from PostgreSQL database and plot the values on the graph having date on x axis and cost on y axis.

Problem Statement: I have data according to julian date in my db but it may not be starting from 1st day of the month. Now my plot shows data for 30 days of the month and I want to plot the values retrieved from db on correct coordinate and not from starting of the x axis coordinate 0. The days previous to the one retieved from db should show 0 or no values.

Requirement: Any logic for displaying this data dynamically on correct coordinate as the plot function exposed by jQuery flot requires manual mapping of coordinates and values.

我使用jQuery的浮在我的PHP页面绘制图形。我的网页检索数据从PostgreSQL数据库和情节的图在X轴和Y轴的值的时间成本。

问题声明:我有数据根据朱利安日期在我的DB,但它可能不是从第一天的一个月。现在我的图显示数据为30天的一个月,我想绘制的值从DB检索正确的坐标,而不是从X轴坐标的开始0。天一从DB上应该显示抑郁症0或无价值。

要求:显示这个数据动态正确的坐标为情节功能的jQuery上暴露需要手动映射任何逻辑坐标值。

answer1: 回答1:

I'm not sure if I understand your question, does this help?

j$.plot(j$("#placeholder"),[d1],{
        xaxis: 
        { mode: "time", 
            min: <?php echo $start_data;?>,
            max: 30
            }
 }

我不知道我是否理解你的问题,这有帮助吗?

j$.plot(j$("#placeholder"),[d1],{
        xaxis: 
        { mode: "time", 
            min: <?php echo $start_data;?>,
            max: 30
            }
 }
php  jquery  graph  charts  flot