I have a kendo bar chart as below. But instead of colors i need to show as some line or dots pattern. Can someone help me on this.
I have the datasource for the chart. Then I am binding that data to datasource. How will i assign the patters? Could you please help me on this
$("#NumActivitiesChart").kendoChart({
title: {
text: "Number of Activities Report",
font: "bold 20px Arial,Helvetica,sans-serif",
color: "brown"
},
//plotArea: {
// background: "#EAEFFA"
//},
dataSource: dsNumActivitiesData,
seriesColors: colours,
series: [{
type: "column",
categoryField: "ChartByName",
field:"NumTestInstances",
gap:5
}],
valueAxis: {
title: {
text: "Number of Activities",
font: "bold 15px Arial,Helvetica,sans-serif",
color: "brown"
}
},
categoryAxis:{
title: {
text: "@Model.Filters.NumActivitiesChartBy",
font: "bold 18px Arial,Helvetica,sans-serif",
color: "brown"
}
},
tooltip: {
visible: true,
template: "${series.name} : ${value}"
}
});
Instead of modifying the bar chart, you could create a line chart. Both chart will be able to work with the same dataSource so the only thing you'll have to change set the
SeriesDefaults
:You can use SVG patterns to apply hatching as a background.
Somewhere in your HTML markup, define an svg element that includes the patterns you want to use, e.g.:
Then when creating the chart, I give each series a unique color so I can easily get the SVG paths of the bars by that fill color. In the render even of the chart, I get the bars and change the fill to the desired pattern.
DEMO
UPDATE:
You can actually just set the series color directly to the pattern and avoid the render event:
Updated DEMO