Tag Archives: graphics

Mask Effect for EffectLayer for Pebble

I’ve written before about EffectLayer library for Pebble smartwatch I’ve been working on. The idea is – user places the layer over screen and that layer applies an effect to screen content.

I’ve started with a few basic effects (invert, mirror) but since then several more developers joined the project adding more cool features. Ron added 90° rotation, zoom and lens effect. Gregoire Sage added cool blur effect. LeFauve not only added FPS effect, but also optimized the library to run the effects in a very efficient way: now effect can be defined as a function (even user defined function!) and that function passed as a parameter to effect_layer_add_effect method along with parameters for that effect.

I, for my part, contributed “mask” effect. What it does is essentially lets you show parts of background image thru user defined mask, creating a feel of transparency. Continue reading →

FusionCharts.RenderChart and ASP.NET UpdatePanel

Fusion Charts

FusionCharts is a very cool cross-platform charting library – it offers huge variety of chart types and mind-blowing special effects. It also offers wide variety of chart rendering options both client- and server-side.

One such option is to render chart in an ASP.NET application. FusionCharts.dll that you get with the package offers handy FusionCharts.RenderChart method that generates all the client-side code you need to display a beautiful chart. Usually it is used something like this:

xLabel1.text = FusionCharts.RenderChart("FusionCharts/Pie2D.swf", "", sChartXmlData, sChartID, iChartWidth, iChartHeight, False, True)

where xLabel1 is a Label or Literal control in your ASPX page and FusionCharts.RenderChart is a function that accepts number of parameters, like chart type, chart XML data, dimensions etc.

It works very well until you want to render the chart inside of Microsoft Ajax UpdatePanel – then nothing works. This happens because FusionCharts.RenderChart function emits some HTML along with JavaScript that do not work during partial postback. FusionCharts suggest hooking up to UpdatePanel life-cycle events, but it’s seems like an overkill, and often doesn’t work (especially if you have a complex project, which this hookup can interfere with). But there’s an alternative solution.
Continue reading →

ASP.NET Chart Control is not rendering image

If you’re using MS Chart Control for .NET Framework 3.5 SP1 (in .NET Framework 4.0 it comes as a part of a framework), you may experience a strange behavior when chart images aren’t rendered on the page:

Chart image isn't rendering

If you’re using HTTP Handler to serve chart images (image URL looks something like “…/ChartImg.axd?i=chart_24dae5cb1f024c4a89f4fe492f05cc59_0.png“) missing mapping in IIS configuration could be to blame Continue reading →

Serving image from ASP.NET MSChart to external applications via WebService

I have an existing ASP.NET application that uses Microsoft Charting control for .NET. I created a CCharting class that hold several methods related to getting data for the chart, applying chart appearance etc. Main method of that class is

Public Sub DrawChart(ByVal i_omsChart As Chart, ByVal i_iChartWidth As Integer, ByVal i_iChartHeight As Integer)

As a 1st parameter it accepts actual chart control from the page, 2nd and 3rd are chart width and height. The method then gets the data for the chart, binds chart to that data, applies chart appearance (colors, series, axises) etc. So drawing a chart is a simple as instantiating the class and calling the method:

Dim oCharting As New CCharting
CCharting.DrawChart(xmsChart,500,300)

where xmsChart is a chart control from HTML markup of the page. The result is displayed on the page:

But now I needed to give access to that chart to external applications, that do not have access neither to chart data nor to Microsoft charting control, may run under different OS’s, be Web apps or not. Continue reading →

Microsoft Chart for ASP.NET 3.5: Correctly setting image storage location

If you’re using Microsoft Chart control for .NET 3.5 you can specify where and how chart images are stored. And if for this purpose you’re trying to use Chart HTTP Handler setting in web config similar to this:

<add key="ChartImageHandler" value="storage=file;url=./Temp"/>

and it is failing (for example chart images are alway created in the root folder of your Web application) – there is an alternative. You can specify location of the images in properties of the chart control itself:

Just add relative path to your storage folder in front of the chart sequence string in “ImageLocation” property. and specify “UseImageLocation” for “ImageStorageMode” property

Easy rounded corners in pure HTML/CSS

Rounded corners add nice touch to look and feel of a Web Page. User interface that employs rounded corners looks more streamlined, more ergonomic. Often to achieve that effect images are used, but this approach doesn’t allow quick style update and has other issues. Fortunately there is another way:

Compare 2 following DIVs:


First uses pretty basic CSS/HTML:

<style type="text/css">
.normal
{
    border: solid 1px blue;
    background-color:yellow;
    height:100px;
    width:200px
}
</style>

<div style="text-align:center">
    <div class="normal">
</div>

Let’s take a closer look at the second: Continue reading →

DHTML JavaScript Graphics – draw without flash

This JavaScript VectorGraphics library provides graphics capabilities for JavaScript: functions to draw circles, ellipses (ovals), oblique lines, polylines and polygons (for instance triangles, rectangles) dynamically into a webpage. Usage of this Vector Graphics library should be easy even if you don’t have JavaScript experience
This is very cool. This javascript graphics libary allows you to draw pretty much any shape, image or text directly into HTML without 3rd party plug-ins like Flash. Speed is amazing and it’s cross-browser compatable too. Get it at  http://www.walterzorn.de