Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Draw vertical line on Chart
posted

How can I draw a vertical line with width 20pz and with height equal to chart height.Moreover how we can give color to that vartical line.

Parents
No Data
Reply
  • 11095
    Offline posted

    Hello Mariko,

    Vertical line can be set by having a two dots in the dataSource representing the beginning and the end of line. A series of scatterLine can be added.

    In order to set line width thickness can be set to 20 and for color brush can be set to red.

    $(function () {
      var data = [
        { x: 5, y: 0 },
        { x: 5, y: 100 },
      ];
    
      $("#chart").igDataChart({
        width: "100%",
        height: "400px",
        dataSource: data,
        axes: [
          {
            name: "x",
            type: "numericX",
            minimumValue: -100,
            maximumValue: 100
          },
          {
            name: "y",
            type: "numericY"
          }
        ],
        series: [
          {
            name: "verticalLine",
            title: "verticalLine",
            type: "scatterLine",
            xAxis: "x",
            yAxis: "y",
            xMemberPath: "x",
            yMemberPath: "y",
            brush: "red",
            thickness: 20
          }
        ]
      });
    });
    
Children
No Data