What components of BAR Graph can be customized within swish?
- 100% custom shape for your bars (simple rectangle,3d, gradient, etc)
- Custom place for your barGraph in the movie
- Put sprite containing barGraph within any other sprite
- Add any type of drag capability to your Graph
- Flip, rotate, and resize entire Graph or only bars
- Easily add, delete, and modify values within swish or text file
- You can add any type of animation within bars
- Add images to bars
- Load dynamic images within bars
- Custom background and layout
- Custom width of bars (within swish, which is automatically detected)
- You can add values more than 100 but that depends upon your movie height
- Custom File Name to fetch data from (within swish)
- Make static or dynamic
- Change values at runtime using any server side script(asp, php, cgi, perl, etc)
- Set custom text color from within swish
Major Features
- Plot your lite graphs within 2 kb
- Supports unlimited values (dependant upon your memory size)
- While plugin is being loaded, sets your graph's alpha to ZERO
- Preloader for plugin is also added
- PLUGIN is almost of 1 k, so you don't need to worry for size and load time
- Use multiple graphs In the same scene and movie.
- Use graphs even containing same data.
Limitations
- If the graph is contained in some masked sprite, it will not show the values
- If the graph is rotated or flipped, will not show the values in both above cases the graph is plotted, but values are not displayed.
- The given values are treated as percentage values not actual values so if you give it values more then 100, it will just increase the bar length, but will not fit the graph (that depends upon your movie height)
There are two ways to use these graphs
1.Pass values from within swish
2.Fetch values from external data file
Now we go one by one
1.Pass values from within swish
Now follow the steps mentioned below
- Open simple.swi
- You will see a sprite named 20,50,100,70, double click to open it
- Now you see it contains further two sub sprites one is BAR, and the other one is self
- Don't rename these sprites. Now open the sprite BAR
- It contains only one Rectangle of size 20x20. it must be set Top-Left from Transform property Tab you may resize its width to desire size. You can also Fill with custom color or gradient or clip image in it.
- That's it for customizing the bar shape
- Now open the sprite named self
- You will see Load Movie Action on its first frame. It is the sprite which load PLUGIN. there is no need to disturb it.
- Run your Movie, and notice the bars. bars are at 20, 50,100, and 70 values. Now question is how to customize values?
- As you see the parent sprite named 20,50,100,70 is the actual place containing your graph's data. For example now you want graph with values 40,50,100,20. Simply rename the parent sprite to 40,50,100,20 and run your movie, you will see the effect.
- Now if you want to place your graph on some other place. Simply close the parent sprite and place it to desired position in your movie.
- If you copy and paster the parent sprite 20,50,100,70, and place it on different position, it will just run only one of them which is loaded first. why? because name of parent sprite must be unique, which means that, there must be atleast one value different from other sprites containing graphs in same place.
- But there may be some situation when you want to plot more thatn one graphs of completely same style and values. What will you do? Simply select each sprite containing graph, and group it as sprite. Now give a unique name to parent most sprite. which will be named as Sprite by default. For doing this you may download Example Simple2, which contains simple2.swi, which contains two same graphs in seperate sprites named graph1 and graph2.
- The same way you may add any type of background to the parnet most sprite as well.
If you want to load data from external file, follow the following steps
1.2. Fetch values from external data file
Now follow the steps mentioned below
- Open from-text.swi
- You will see a sprite named text. Simply, it is the name of the external text file, from which the graph data will be loaded, which mean "text.txt". You must not include the ".txt" in sprite name. it is automatically added to sprite name and file is loaded. Now the question is! How it is detected either to load from external file or use static data? Answer is too simple
- Just open the sprite text. You will see a sprite named BAR (as it was in static bars), and sprite named external. Note carefullt. Whenever you need to load data from external files you will rename the sprite to external and if to use static data from within swish, you will use its name self, means: self : plot graphs from values contained in the name of parent sprite external : load file as name of parent sprite and get values from it. As In this example we are loading data from externl file so we used its name external, and named the parent sprite as text, which means load data from text.txt. For example you want to load data from myGraph.txt, you will rename the parent sprite as myGraph.
- Now the question appears:
How to write text file to be used by graph?
It is so simple For example you want to plot graph for values 100,20,60,70,30,40,50 (which are already in text.txt). You will write &values=100,20,60,70,30,40,50 and add one more thing as &done=1 so your final text in the file, will look like this &values=100,20,60,70,30,40,50&done=1
The &done=1 is added to create dynamic preloader when external resource is being loaded.
And remember:
If your graph is of type which loads external data, cannot be tested in FlashPlayer,
If you want to test it within swish, then test it in browser and preference must be set to SWI load/save folder, which can be selected from Tool menu.






