This sample demonstrates how to customize the chart shapes with shapeRendering Event.
Columns with value bigger than 50 are colored in red.
For detailed implementation, please take a look at the Aspx code tab.
<%@ Page Language="C#" %>
<%@ Register assembly="JQChart.Web" namespace="JQChart.Web.UI.WebControls" tagprefix="jqChart" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<link rel="stylesheet" type="text/css" href="~/Content/jquery.jqChart.css" />
<link rel="stylesheet" type="text/css" href="~/Content/themes/le-frog/jquery-ui-1.8.20.css" />
<script src="<% = ResolveUrl("~/Scripts/jquery-1.11.1.min.js") %>" type="text/javascript"></script>
<script src="<% = ResolveUrl("~/Scripts/jquery.jqChart.min.js") %>" type="text/javascript"></script>
</head>
<body>
<form runat="server">
<script lang="javascript" type="text/javascript">
$(document).ready(function () {
$('#<%= Chart1.ClientID %>').bind('shapeRendering', function (e, shape) {
if (shape.context.y > 50) {
shape.fillStyle = 'red';
}
});
});
</script>
<jqChart:Chart ID="Chart1" Width="500px" Height="300px" runat="server">
<Title Text="shapeRendering Event"></Title>
<Background FillStyleType="LinearGradient" X1="0">
<ColorStops>
<jqChart:ColorStop Color="#d2e6c9" />
<jqChart:ColorStop Color="white" Offset="1" />
</ColorStops>
</Background>
<Border StrokeStyle="#6ba851" />
<Animation Enabled="True" Duration="00:00:01" />
<Series>
<jqChart:ColumnSeries Title="Column">
<XValues>
<jqChart:StringValue Value="A" />
<jqChart:StringValue Value="B" />
<jqChart:StringValue Value="C" />
<jqChart:StringValue Value="D" />
<jqChart:StringValue Value="E" />
<jqChart:StringValue Value="F" />
<jqChart:StringValue Value="G" />
<jqChart:StringValue Value="H" />
</XValues>
<YValues>
<jqChart:DoubleValue Value="46" />
<jqChart:DoubleValue Value="35" />
<jqChart:DoubleValue Value="68" />
<jqChart:DoubleValue Value="30" />
<jqChart:DoubleValue Value="27" />
<jqChart:DoubleValue Value="85" />
<jqChart:DoubleValue Value="43" />
<jqChart:DoubleValue Value="29" />
</YValues>
</jqChart:ColumnSeries>
</Series>
</jqChart:Chart>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace SamplesBrowser.Models
{
public class EmptyChartModel
{
}
}