mvc3 웹 페이지에 누적 시계열을 표시하려면 flot을 사용하고 있습니다. 그래프가 올바르게 표시되면 xaxis 서식이 그래프에 영향을 미치지 않습니다.Flot 시계열이 서식 지정되지 않음
는 I는 I가
<script id="source" type="text/javascript">
$(function() {
var total = @ViewBag.Graph.SerialisedTotal;
var attention = @ViewBag.Graph.SerialisedAttention;
var notify = @ViewBag.Graph.SerialisedNotify;
var complete = @ViewBag.Graph.SerialisedComplete;
var fail = @ViewBag.Graph.SerialisedFail;
var stack = true, bars = false, lines = true, steps = false;
function plotWithOptions() {
$.plot($("#graph"), [{label:'Need Attention',data:attention},
{label:'Ready to apply',data:notify},
{label:'Failed',data:fail},
{label:'Completed',data:complete}],
{ series: {stack : stack,
lines: { show: lines,
fill: true,
steps: steps } ,
xaxis: {mode: 'time' ,
timeformat: "%d",
tickSize: [5, "day"] } }
});
}
plotWithOptions();
});
그래프 원시 진드기를 표시하는 것 및 다음 프리뷰 뷰 다음 코드 뷰로
var range = DateTime.Today.AddDays(-30);
var graphData = _db.UpdateStatistics.Where(x => x.Day > range).OrderBy(x=> x.Day);
var viewGraph = new SubscriptionUpdatesGraphViewModel();
foreach (var entry in graphData)
{
viewGraph.Total.Add(new Tuple<long, int>(entry.Day.Ticks, entry.Total));
viewGraph.Attention.Add(new Tuple<long, int>(entry.Day.Ticks, entry.Attention));
viewGraph.Complete.Add(new Tuple<long, int>(entry.Day.Ticks, entry.Complete));
viewGraph.Fail.Add(new Tuple<long, int>(entry.Day.Ticks, entry.Failed));
viewGraph.Notify.Add(new Tuple<long, int>(entry.Day.Ticks, entry.Pending));
}
ViewBag.Graph = viewGraph;
return View(result);
동안 데이터를 전달할 그 외 아무것도
예를 들어 데이터 :이 작은 문제 몇하지만 당신은 기본적으로 거기
var total = [[634754880000000000,12],[634755744000000000,10],];
var attention = [[634754880000000000,2],[634755744000000000,0],];
var notify = [[634754880000000000,2],[634755744000000000,10],];
var complete = [[634754880000000000,3],[634755744000000000,10],];
var fail = [[634754880000000000,5],[634755744000000000,0],];
어떤 Flot 버전을 사용하고 있습니까? – DNS
데이터 세트 중 하나를 올리십시오 (즉,'total' 변수의 x, y 값은 무엇입니까?) ... – Ryley
샘플 데이터를 추가하고 버전 0.7을 사용하고 있습니다 – Marcom