Archive for the ‘Tips and tricks’ Category

Using AnyChart with JSON and JavaScript

Friday, June 6th, 2008

Until now AnyChart was able to get data only in XML format. However it’s not always convenient and requires at least knowledge of XML.

Now we make the life of AnyChart users easier and add the ability of handy Flash chart implementation in JavaScript. Now AnyChart.js has a new method - setJSData, that allows you to set parameters and data to the chart as a JavaScript object.

You can view a simple example here:
http://anychart.com/tips_and_tricks/xml-and-js/js-sample.html

How to create an object with settings and data:An object with settings and data has the same structure as AnyChart XML. XML nodes and attributes are properties. Nodes, that can be repeated (for example, <point />) are arrays.

For example:

var chartData = {
charts: {
chart: {
chart_settings: {
title: { text: “Chart Title” } },
data: {
series: [
point: [{name: “pt1″, y: 12}, {name: “pt2″, y: 23}]
]
}
}
}
}

Or:

var chartData = {}
chartData.charts = {};
chartData.charts.chart = {};
chartData.charts.chart.chart_settings = {};
chartData.charts.chart.chart_settings.title = {};
chartData.charts.chart.chart_settings.title.text = “Chart Title”;
chartData.charts.chart.data = {};
chartData.charts.chart.data.series = [];

var seriesObj = {};
seriesObj.point = [];
seriesObj.point.push({name: “Pt1″, y: 12});
seriesObj.point.push({name: “Pt1″, y: 23});

chartData.charts.chart.data.series.push(seriesObj);

Object’s structure is equivalent to XML structure. The description of XML you can find here:
http://anychart.com/products/anychart/docs/xmlReference/index.html

Setting chart description object to AnyChart is done using setJSData method.

Also we’ve created several examples of using setJSData, including JSON example:

1. An example of object-creation using JavaScript:http://anychart.com/tips_and_tricks/xml-and-js/js-sample.html

2. An example of JSON-creation forming:http://anychart.com/tips_and_tricks/xml-and-js/json-sample.html

3. An example of JSON-data loading from the text file using AJAX:
http://anychart.com/tips_and_tricks/xml-and-js/json-ajax-sample.html

Creating custom design-time preview for Flex 3 components

Friday, February 29th, 2008

Sometimes it is necessary to create custom preview of the component in the Flex Builder “Design” view.
It is undocumented feature ;-)
I’ve found very interesting class in the Flex SDK 3: mx.core.UIComponentGlobals.

This class contains static field designMode:Boolean.

Just check that field in your component code.
You can download example component with the source code from here:
http://anychart.com/tips_and_tricks/designMode/DesignModeComponent.zip

Also you can download the usage sample:
http://anychart.com/tips_and_tricks/designMode/DesignModeComponentSample.zip

Running in the Flex Builder “Design” mode it shows AnyChart image. But when it runs in the flash player it shows only gray rectangle.

New article “Creating interactive digital dashboards from scratch” by Tim Loginov

Monday, October 29th, 2007

http://www.anychart.com/products/anychart/docs/creating-dashboard-from-scratch.php

Like the instrument panel in a car, the computer version-dashboard displays critical info in easy-to-read graphics, assembled from data pulled in real time from corporate software programs. Dashboards deliver the detailed information needed by everyone for day-to-day decision-making. Simple yet powerful analysis allows any user to discover vital trends in business performance and continuously monitor the performance of your organization at all levels and in real time.

Dashboards provide your business with real-time business intelligence across all areas of your company – from accounting and sales, to fulfillment and support. The Dashboard offers instant snapshots of your designated key performance indicators (KPIs), and provides real-time trend graphs and ad hoc reports appropriate for each role in your business. With direct drill-down capability, you can move from a summary level directly to greater detail, and you can see real-time information to proactively manage for better results.

While most enterprise dashboards in production are probably still custom built, we provide you a new way of dashboard creation - using AnyChart Flash Component Dashboard mode. Since all charts created by AnyChart Flash Chart Component are rendered using a single swf file it is very easy to place such swf file to your web-site and provide it with an XML configuration file that configures a dashboard.

In this article we will create step-by-step a sample dashboard, at first - we will make a static one - that can be used for presentation purposes, and then - we will add interactivity, which makes dashboard a really useful and modern tool of business data analytics. We’ll go thought all steps from “paper-design” created by hand to the interactive Flash dashboard.

paper-design result

Read it here http://www.anychart.com/products/anychart/docs/creating-dashboard-from-scratch.php

This article was written by Tim Loginov as part of AnyChart Documentation.

ACPrintManager 0.1 - library for content control of printing from a browser with some bug fixes for Firefox and Internet Explorer

Saturday, October 27th, 2007

As I promised I’ve uploaded source code for solving the problem with flash content printing in Firefox and an example of its usage in Flash.

FFPrintFix library was extended and now it is called ACPrintManager. Now it is not only bug fix for printing, but also content control for printing from a browser.

See all details here:
http://www.anychart.com/blog/projects/acprintmanager/

Solving problem with printing Flash content in Firefox browser

Sunday, September 23rd, 2007

I will let out a secret: we have solved a problem with printing Flash/Flex applications in Firefox :)

Here is the article how you can use it. ;-)

UPD1: http://www.anychart.com/blog/2007/10/27/ac-print-manager/
UPD2: http://www.anychart.com/blog/projects/acprintmanager/
UPD3: LGPL license

(more…)

How to add Adobe Macromedia Flash content into Microsoft PowerPoint presentations

Sunday, September 23rd, 2007

Integrating a Flash movie inside PowerPoint allows vector animation and interactivity to be added to a PowerPoint presentation. This strategy can be used to increase the performance. And it is really easy ;-)

Here is a simple tutorial how to embed AnyChart into PowerPoint presentations:
Using AnyChart with PowerPoint presentations

add-flash-to-powerpoint-screen