EJ2 chart supports horizontal and vertical strip lines and customization of stripline in both orientation.
You can create Horizontal stripline by adding the stripline
in the vertical axis and set visible
option to true.
Striplines are rendered in the specified start to end range and you can add more than one stripline for an axis.
<ejs-chart id="container" width="60%">
<e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
<e-chart-axes>
<e-chart-axis name="yAxis" valueType="Category">
<e-striplines>
<e-stripline visible="true" start="20" end="30" color="red"></e-stripline>
</e-striplines>
</e-chart-axis>
</e-chart-axes>
<e-series-collection>
<e-series dataSource="ViewBag.dataSource" xName="x" yName="y" yAxisName="yAxis" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"></e-series>
</e-series-collection>
</ejs-chart>
public ActionResult Index()
{
List<StripLineChartData> chartData = new List<StripLineChartData>
{
new StripLineChartData { x = "Sun", y = 28 },
new StripLineChartData { x = "Mon", y = 27 },
new StripLineChartData { x = "Tue", y = 33 },
new StripLineChartData { x = "Wed", y = 36 },
new StripLineChartData { x = "Thu", y = 28 },
new StripLineChartData { x = "Fri", y = 30 },
new StripLineChartData { x = "Sat", y = 31 }
};
ViewBag.dataSource = chartData;
return View();
}
public class StripLineChartData
{
public string x;
public double y;
}
You can create vertical stripline by adding thestripline
in the horizontal axis and set visible
option to true.
Striplines are rendered in the specified start to end range and you can add more than one stripline for an axis.
<ejs-chart id="container" width="60%">
<e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
<e-chart-axes>
<e-chart-axis name="xAxis" valueType="Category">
<e-striplines>
<e-stripline visible="true" start="0" end="3" color="red"></e-stripline>
</e-striplines>
</e-chart-axis>
</e-chart-axes>
<e-series-collection>
<e-series dataSource="ViewBag.dataSource" xName="x" yName="y" xAxisName="xAxis" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"></e-series>
</e-series-collection>
</ejs-chart>
public ActionResult Index()
{
List<StripLineChartData> chartData = new List<StripLineChartData>
{
new StripLineChartData { x = "Sun", y = 28 },
new StripLineChartData { x = "Mon", y = 27 },
new StripLineChartData { x = "Tue", y = 33 },
new StripLineChartData { x = "Wed", y = 36 },
new StripLineChartData { x = "Thu", y = 28 },
new StripLineChartData { x = "Fri", y = 30 },
new StripLineChartData { x = "Sat", y = 31 }
};
ViewBag.dataSource = chartData;
return View();
}
public class StripLineChartData
{
public string x;
public double y;
}
Starting value in specific strip line can be customized by start
property in strip line. Similarly, ending value
is customized by end
. It can be also set for starting from the corresponding origin of the axis by startFromOrigin
.
Size of the strip line is customized by size
. Border for the stripline is customized by border
.
Order of the strip line such that whether it should be rendered in behind or over the series elements
is customized by zIndex
.
<ejs-chart id="container" width="60%">
<e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
<e-chart-axes>
<e-chart-axis name="xAxis" valueType="Category">
<e-striplines>
<e-stripline visible="true" startFromAxis="true" size="4" zIndex="Behind" opacity="0.5" color="green"></e-stripline>
</e-striplines>
</e-chart-axis>
</e-chart-axes>
<e-series-collection>
<e-series dataSource="ViewBag.dataSource" xName="x" yName="y" xAxisName="xAxis" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"></e-series>
</e-series-collection>
</ejs-chart>
public ActionResult Index()
{
List<StripLineChartData> chartData = new List<StripLineChartData>
{
new StripLineChartData { x = "Sun", y = 28 },
new StripLineChartData { x = "Mon", y = 27 },
new StripLineChartData { x = "Tue", y = 33 },
new StripLineChartData { x = "Wed", y = 36 },
new StripLineChartData { x = "Thu", y = 28 },
new StripLineChartData { x = "Fri", y = 30 },
new StripLineChartData { x = "Sat", y = 31 }
};
ViewBag.dataSource = chartData;
return View();
}
public class StripLineChartData
{
public string x;
public double y;
}
You can customize the text rendered in stripline by textStyle
property. Rotation of the strip line text can be changed by rotation
property.
Horizontal and Vertical alignment of stripline text can be changed by horizontalAlignment
and verticalAlignment
property.
<ejs-chart id="container" width="60%">
<e-chart-primaryxaxis valueType="Category"></e-chart-primaryxaxis>
<e-chart-axes>
<e-chart-axis name="xAxis" valueType="Category">
<e-striplines>
<e-stripline visible="true" startFromAxis="true" size="4" zIndex="Behind" opacity="0.5" color="green"
text="good" verticalAlignment="Middle" horizontalAlignment="Middle" rotation="90"></e-stripline>
</e-striplines>
</e-chart-axis>
</e-chart-axes>
<e-series-collection>
<e-series dataSource="ViewBag.dataSource" xName="x" yName="y" xAxisName="xAxis" type="@Syncfusion.EJ2.Charts.ChartSeriesType.Column"></e-series>
</e-series-collection>
</ejs-chart>
public ActionResult Index()
{
List<StripLineChartData> chartData = new List<StripLineChartData>
{
new StripLineChartData { x = "Sun", y = 28 },
new StripLineChartData { x = "Mon", y = 27 },
new StripLineChartData { x = "Tue", y = 33 },
new StripLineChartData { x = "Wed", y = 36 },
new StripLineChartData { x = "Thu", y = 28 },
new StripLineChartData { x = "Fri", y = 30 },
new StripLineChartData { x = "Sat", y = 31 }
};
ViewBag.dataSource = chartData;
return View();
}
public class StripLineChartData
{
public string x;
public double y;
}
You can create dash array stripline by using dashArray
property. The Striplines are rendered with specified dash array values.
The strip lines to be drawn repeatedly at the regular intervals – this will be useful when you want to mark an event that occurs recursively along the timeline of the chart. Following properties are used to configure this feature.
isRepeat
- It is used for enable / disable the recurrence strip line.repeatEvery
- It is used for mention the stripline interval.repeatUntil
- It specifies the end value at which point strip line has to stop repeating.The sizeType
property refers the size of the stripline. They are,
Auto
Pixel
Years
Months
Days
Hours
Minutes
Seconds
You can create stripline in a particular region with respect to segment. You can enable the segment stripline using isSegmented
property. The start and end value of this type of stripline can be defined using segmentStart
and segmentEnd
properties.
isSegmented
- It is used for enable the segment stripline.segmentStart
- Used to change the segment start value. Value correspond to associated axis.segmentEnd
- Used to change the segment end value. Value correspond to associated axis.segmentAxisName
- Used to specify the name of the associated axis.