2017-02-20 11 views
0

У меня есть следующий пример данных с некоторыми Точками, имеющими те же значения x, y, что означает, что они появляются в наложенной диаграмме столбцов друг на друга - есть ли способ, чтобы они отображались поверх друг друга, например, в виде сгруппированных диаграмм столбцов.Борьба с двумя точками данных с одинаковыми значениями x и y ведет себя как stacked Тип диаграммы столбцов, то есть друг на друга

см рабочего образца: http://jsfiddle.net/yjxoLr9e/

часть данных JSon:

"purchaseRows": [ 
{x: new Date("2017-03-10"), y:600}, 
{x: new Date("2017-04-06"), y:504}, 
{x: new Date("2017-04-06"), y:600}, 
{x: new Date("2017-05-03"), y:504}, 
{x: new Date("2017-05-03"), y:504}, 
{x: new Date("2017-06-05"), y:504}, 
{x: new Date("2017-08-07"), y:714}, 
{x: new Date("2017-09-04"), y:714}, 
{x: new Date("2017-10-02"), y:504}, 
{x: new Date("2017-11-06"), y:504}, 
{x: new Date("2017-12-04"), y:540}, 
], 

и массив данных:

data: [  { type: "stepLine", showInLegend: true, lineThickness: 2, name: "Transactions", markerSize: 5, markerType: "circle", color: "SteelBlue", dataPoints: json.transactionData }, 
        { type: "stepLine", lineDashType: "dot", showInLegend: true, lineThickness: 2, name: "Stock forecast", markerSize: 5, markerType: "circle", color: "SteelBlue", dataPoints: json.stockForecast }, 
        { type: "stackedColumn", showInLegend: true, lineThickness: 0, name: "Backlog", markerSize: 8, markerType: "circle", color: "coral", dataPoints: json.currentbacklog }, 
        { type: "stackedColumn", showInLegend: true, lineThickness: 0, name: "Demand", markerSize: 8, markerType: "circle", color: "red", dataPoints: json.unconsumedFcst }, 
        { type: "line", showInLegend: true, lineThickness: 0, name: "Stock", markerSize: 8, markerType: "circle", color: "red", dataPoints: json.currentStock }, 
        { type: "column", showInLegend: true, lineThickness: 2, name: "Purchase rows", markerSize: 8, markerType: "circle", color: "lightgreen", dataPoints: json.purchaseRows } 

     ], 
+1

CanvasJS действительно имеет штатную диаграмму столбцов. Вероятно, вы можете это использовать. Вот страница документации на том же самом. : http://canvasjs.com/docs/charts/chart-types/html5-stacked-column-chart/ – Beevk

ответ

1

Beevk является правильным типом диаграммы stackedColumn DORS трюка.

 Смежные вопросы

  • Нет связанных вопросов^_^