Question

enter image description hereHow to draw a vertical line in a line chart using Html5 and kendo UI ? can anyone help me out to solve this problem ?

Was it helpful?

Solution

Try this:

// let chart be the id
$("#chart").kendoChart({
     categoryAxis: {
         notes: {
             line: {
                 length: 300
             },
             data: [{
                 value: new Date(2012, 0, 3),
                 label: {
                     text: "-" //text you want to show
                 } 
             }]
         }
     }
 });

Demo: http://jsbin.com/obuweca/26

/* WITHOUT CIRCLE */

$("#chart").kendoChart({
    categoryAxis: {
        notes: {
            line: {
                length: 300
            },
            icon: {
                border: {
                    width: 0
                }
            },
            // Initial notes
            data: [{
                value: new Date(2012, 0, 3)
            }]
        }
    }
});

DEMO: http://jsbin.com/obuweca/29/

OTHER TIPS

In kendo documentation is example how do draw custom lines on chart. Horizontal and vertical.

http://docs.telerik.com/kendo-ui/controls/charts/how-to/custom-plot-bands

You can customize lines by editing stroke:

 stroke: {
          color: "red",
          width: 1,
          dashType:"dash"
        }

You can also try to use the column-Chart.

Just extend the series:

  series: [{
                type: "line",
                field: "value",
                categoryField: "date"
            },
            {
                type:"column", 
                field: "valueColumn", 
                gap: 300
            }]

and the dataSource.data with a new field like: valueColumn.

See also the Example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top