<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>techrageo.us &#187; XML</title>
	<atom:link href="http://techrageo.us/taxonomy/categories/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://techrageo.us</link>
	<description>insight on technology</description>
	<lastBuildDate>Sat, 22 Oct 2011 12:18:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Wildcard Namespaces In XPath</title>
		<link>http://techrageo.us/2008/11/01/wildcard-namespaces-in-xpath/</link>
		<comments>http://techrageo.us/2008/11/01/wildcard-namespaces-in-xpath/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 20:43:07 +0000</pubDate>
		<dc:creator>bill</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[namespaces]]></category>
		<category><![CDATA[xpath]]></category>

		<guid isPermaLink="false">http://techrageo.us/2008/11/01/wildcard-namespaces-in-xpath/</guid>
		<description><![CDATA[Select namespaced elements in XPath without specifying the namespace. Every once in a while you need to get to an XML element that is tucked within some namespace or another, but you really are not in the mood to deal with namespaces. You really don&#8217;t want to mess with XmlNamespaceManager or its ilk; or maybe [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Select namespaced elements in XPath without specifying the namespace.</strong></p>
<p>Every once in a while you need to get to an XML element that is tucked within some namespace or another, but you really are not in the mood to deal with namespaces. You really don&#8217;t want to mess with XmlNamespaceManager or its ilk; or maybe you only have XPath to work with.</p>
<p>When this comes up, it usually takes me a few moments to remember, but the magic is the local-name() function.</p>
<p><strong>XML</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:bookstore</span> <span style="color: #000066;">xmlns:gw</span>=<span style="color: #ff0000;">&quot;http://www.moonbats.com/gw&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Warming Up To The New Ice Age<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>A. Nother Lemming<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>The Sky Is Falling<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Chicken Little<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Glaciers Will Burn Us All<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Chicken Little<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Data: A Cookbook<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Grant Me Money<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:book<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gw:bookstore<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><strong>XPath</strong></p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">//*[local-name()='title']</pre></div></div>

<p>This basically says to select any element where the local name, i.e. the element name minus the namespace, is equal to &#8216;title&#8217;.</p>
<p>This can be extended with other XPath functions. In the following example we want to get the titles of books by Chicken Little.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">//*[ local-name() = 'title' and (../*[local-name() = 'author'
	and contains( text(), 'Chicken Little' ) ]) ]</pre></div></div>

<p>Here we&#8217;re selecting elements with a local name of &#8216;title&#8217; and a sibling element named author and where that sibling&#8217;s value contains &#8216;Chicken Little&#8217;.</p>
<p>This syntax is not as convenient as something like <tt>/*:title</tt>, but at least it does the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://techrageo.us/2008/11/01/wildcard-namespaces-in-xpath/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Communicating Charts with Flex</title>
		<link>http://techrageo.us/2007/06/19/communicating-charts-with-flex/</link>
		<comments>http://techrageo.us/2007/06/19/communicating-charts-with-flex/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 08:59:46 +0000</pubDate>
		<dc:creator>grant</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://techrageo.us/2007/06/19/communicating-charts-with-flex/</guid>
		<description><![CDATA[Getting started Creating graphs with Adobe&#8217;s Flex 2 is a pretty simple task, just throw together some short XML and you&#8217;re done. But like most &#8220;easy&#8221; technologies things get a little more difficult when you want to do more advanced things like making sections of the graphs stand out or keeping multiple graphs in sync [...]]]></description>
			<content:encoded><![CDATA[<h3>Getting started</h3>
<p>Creating graphs with <a href="http://www.adobe.com/products/flex/">Adobe&#8217;s Flex 2</a> is a pretty simple task, just throw together some short XML and you&#8217;re done.  But like most &#8220;easy&#8221; technologies things get a little more difficult when you want to do more advanced things like making sections of the graphs stand out or keeping multiple graphs in sync with one another.  In this tutorial I will take you through how to give your graphs a little more &#8220;flash&#8221; and how to make things happen in one graph when you click on another graph.</p>
<p>If you haven&#8217;t already you can <a href="http://www.adobe.com/products/flex/">download the free Flex 2 SDK from Adobe</a>. And you can <a href="http://www.adobe.com/products/flex/charting/">download a free trial of the Flex 2 charting library</a>.</p>
<p>In your favorite text editor (<a href="http://www.eclipse.org/">Eclipse</a> anyone?) start a new file and start with some basic code:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Application</span> <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;*&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:local</span>=<span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #000066;">xmlns:view</span>=<span style="color: #ff0000;">&quot;view.*&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">    import mx.collections.ArrayCollection;</span>
&nbsp;
<span style="color: #339933;">    [Bindable]</span>
<span style="color: #339933;">    private var profitPeriods:ArrayCollection = new ArrayCollection( [</span>
<span style="color: #339933;">    { period: &quot;Qtr1 2006&quot;, profit: 32 },</span>
<span style="color: #339933;">    { period: &quot;Qtr2 2006&quot;, profit: 47 },</span>
<span style="color: #339933;">    { period: &quot;Qtr3 2006&quot;, profit: 62 },</span>
<span style="color: #339933;">    { period: &quot;Qtr4 2006&quot;, profit: 35 },</span>
<span style="color: #339933;">    { period: &quot;Qtr1 2007&quot;, profit: 25 },</span>
<span style="color: #339933;">    { period: &quot;Qtr2 2007&quot;, profit: 55 } ]);</span>
<span style="color: #339933;">  ]]&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:Panel</span> <span style="color: #000066;">x</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">y</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Profit By Period&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:PieChart</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;profitPie&quot;</span> <span style="color: #000066;">dataProvider</span>=<span style="color: #ff0000;">&quot;{profitPeriods}&quot;</span> <span style="color: #000066;">showDataTips</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:series<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mx:PieSeries</span> <span style="color: #000066;">field</span>=<span style="color: #ff0000;">&quot;profit&quot;</span> <span style="color: #000066;">nameField</span>=<span style="color: #ff0000;">&quot;period&quot;</span> <span style="color: #000066;">labelPosition</span>=<span style="color: #ff0000;">&quot;callout&quot;</span> <span style="color: #000066;">showDataEffect</span>=<span style="color: #ff0000;">&quot;{interpolate}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:series<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:PieChart<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/mx:Application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h3>Getting more advanced</h3>
<p>This code basically creates a sample dataset and a pie chart to display it.  Nothing fancy and if we were using an XML feed we wouldn&#8217;t have any need for ActionScript at all, since we are only using it to create the data in this example.</p>
<p>Now let&#8217;s say that your customer (or boss) wants to have the data shown in multiple ways.  For our example let&#8217;s say that he wants to see a pie graph, a bar graph and a data grid.  So he can see the data in whatever way he wants to.  No problem there, throwing another chart and grid on the page is just a few more lines of xml, but what if they are to interact?  Say your boss wants to be able to click on a piece of the pie chart and have the same record highlighted in the pie chart, the column chart and the data grid.  Now we&#8217;re going to have to whip out the ActionScript.</p>
<p>We are going to need three methods, one to highlight the pie graph, one for the column chart and a final one for the data grid.  Then we can call all three of these methods whenever a chart or grid is clicked on.  We are using three methods instead of just one giant method in case we ever want to use them again, in a different circumstance.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">DisplayObject</span>;  <span style="color: #808080; font-style: italic;">//The items in the column chart are DisplayObjects</span>
&nbsp;
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> prevSelectedColumn:DisplayObject;
<span style="color: #808080; font-style: italic;">/*
We want to be able to &quot;unhighlight&quot; whatever column we highlighted last time, so
we'll create a variable to keep it simple. If you are using a graph with
multiple datasets then you'll obviously want to loop through them and reset them
that way instead of using this method.
*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
* This function will highlight a column/bar in a column/bar chart
* @param barName  The name/id of the bar/column chart
* @param barIndex The position of the column you want to highlight
*/</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> barHighlight<span style="color: #66cc66;">&#40;</span> barName:<span style="color: #0066CC;">String</span>, barIndex:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>prevSelectedColumn<span style="color: #66cc66;">&#41;</span>  <span style="color: #808080; font-style: italic;">//If we selected something before, unselect it:</span>
  <span style="color: #66cc66;">&#123;</span>
    prevSelectedColumn.<span style="color: #006600;">alpha</span> = .8;
    prevSelectedColumn.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;  <span style="color: #808080; font-style: italic;">//remove the filters</span>
  <span style="color: #66cc66;">&#125;</span>
&nbsp;
  <span style="color: #808080; font-style: italic;">//This gets the individual column that we are looking for</span>
  prevSelectedColumn = <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#91;</span>barName<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">series</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">getChildAt</span><span style="color: #66cc66;">&#40;</span> barIndex <span style="color: #66cc66;">&#41;</span>;
&nbsp;
  <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>prevSelectedColumn<span style="color: #66cc66;">&#41;</span>  <span style="color: #808080; font-style: italic;">//highlight the new column:</span>
  <span style="color: #66cc66;">&#123;</span>
    prevSelectedColumn.<span style="color: #006600;">alpha</span> = <span style="color: #cc66cc;">1</span>;
    prevSelectedColumn.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #000000; font-weight: bold;">new</span> GlowFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> DropShadowFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>;
  <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
* This function will highlight a row in a data grid
* @param dataGridName The name of the data grid that contains the row to highlight
* @param rowIndex   The position of the row in the grid to highlight
*/</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> rowHighlight<span style="color: #66cc66;">&#40;</span> dataGridName:<span style="color: #0066CC;">String</span>, rowIndex:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#91;</span>dataGridName<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">selectedIndex</span> = rowIndex;  <span style="color: #808080; font-style: italic;">//the easy one...</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*
* This function &quot;explodes&quot; a piece of pie from a pie chart
* @param pieName  The name of the pie chart that is to be modified
* @param pieIndex The index of the pie piece that is to be modified
*/</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> pieHighlight<span style="color: #66cc66;">&#40;</span> pieName:<span style="color: #0066CC;">String</span>, pieIndex:<span style="color: #0066CC;">int</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> explodeData:<span style="color: #0066CC;">Array</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span>;  <span style="color: #808080; font-style: italic;">//create an empty array</span>
  explodeData<span style="color: #66cc66;">&#91;</span> pieIndex <span style="color: #66cc66;">&#93;</span> = <span style="color: #cc66cc;">0.15</span>; <span style="color: #808080; font-style: italic;">//Set the index of our pie piece to &gt; 0</span>
  <span style="color: #0066CC;">this</span><span style="color: #66cc66;">&#91;</span>pieName<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">series</span><span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">perWedgeExplodeRadius</span> = explodeData;
  <span style="color: #808080; font-style: italic;">/*
  The pie's wedges can be &quot;exploded&quot; outward to highlight them. The amount is
  controlled by an array, so we just create a empty array (which would set
  everything to no padding) and add padding for the index that is to be
  highlighted. This has the added bonus of un-highlighting the piece that was last
  highlighted (if any). Sweet!
  */</span>
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<h3>Adding events</h3>
<p>Of course, this is using inline ActionScript.  If you want to separate it into another file you&#8217;ll have to use &#8220;Application.application&#8221; instead of &#8220;this&#8221; (see the downloadable GraphHighlighting.as file below).  That should give us a snazzy little effect every time we click on an item in any of the charts or in the grid.   But they won&#8217;t be doing any effects unless we add event handlers to our objects.  Let&#8217;s do that now.</p>
<p>So change the xml for your pie chart and add this to the PieChart tag:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">itemClick=<span style="color: #ff0000;">&quot;pieChartClick(event, 'profitGrid', 'profitBar');&quot;</span></pre></div></div>

<p>And then you can add the ActionScript to handle that event (which, of course, will call our handy three functions):</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*
* This is run when the pie chart is clicked on
* @param event    The click event
* @param dataGridName The string name of the data grid that should be highlighted
* @param barName  The string name of the column chart that should be highlighted
*/</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> pieChartClick<span style="color: #66cc66;">&#40;</span> event:ChartItemEvent, dataGridName:<span style="color: #0066CC;">String</span>, barName:<span style="color: #0066CC;">String</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
  pieHighlight<span style="color: #66cc66;">&#40;</span> event.<span style="color: #006600;">currentTarget</span>.<span style="color: #006600;">id</span> , event.<span style="color: #006600;">hitData</span>.<span style="color: #006600;">chartItem</span>.<span style="color: #0066CC;">index</span> <span style="color: #66cc66;">&#41;</span>;
  rowHighlight<span style="color: #66cc66;">&#40;</span> dataGridName, event.<span style="color: #006600;">hitData</span>.<span style="color: #006600;">chartItem</span>.<span style="color: #0066CC;">index</span><span style="color: #66cc66;">&#41;</span>;
  barHighlight<span style="color: #66cc66;">&#40;</span> barName, event.<span style="color: #006600;">hitData</span>.<span style="color: #006600;">chartItem</span>.<span style="color: #0066CC;">index</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Then do this for the other chart and the datagrid and you&#8217;ll be set.</p>
<h3>Conclusion and downloads</h3>
<p>So, if you did your calculations correctly, remembered to carry the one and crossed your fingers you probably ended up with something like this:</p>
<div style="width: 490px">
<object width="480" height="480" codebase="http://active.macromedia.com/flash7/cabs/ swflash.cab#version=9,0,0,0"><param name="src" value="http://www.techrageo.us/code/communicateflex/Chart.swf"><param name="quality" value="high"><embed src="http://www.techrageo.us/code/communicateflex/Chart.swf" width="480" height="480" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed></object>
</div>
<p>Actually, it probably won&#8217;t look like that, but the sample code download does (see below).</p>
<p>It is more likely that you&#8217;ll probably be making the charts communicate using different data (click on one part of a chart and get detailed information in another chart), but this should at least get you started in the right direction.</p>
<p>Download the <a href="http://techrageo.us/code/communicateflex/Chart.mxml">complete inline ActionScript example</a>: This file is the complete example and you should be able to save it and compile it with the mxml compiler that came with the Flex 2 SDK (assuming you have the charting library, or the charting trial library).</p>
<p>Download the <a href="http://techrageo.us/code/communicateflex/GraphHighlighting.as">&#8220;external&#8221; ActionScript methods</a>: This file is what you can use if you want to keep these functions in your library for future use.  I put this in the FlexAS.GraphHighlighting package, so if you don&#8217;t change the package name you should put this into a &#8220;FlexAS/GraphHighlighting/&#8221; subfolder off of your main flex directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://techrageo.us/2007/06/19/communicating-charts-with-flex/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>PHP and WordPress SVG Basics</title>
		<link>http://techrageo.us/2007/04/07/php-and-wordpress-svg-basics/</link>
		<comments>http://techrageo.us/2007/04/07/php-and-wordpress-svg-basics/#comments</comments>
		<pubDate>Sun, 08 Apr 2007 01:54:58 +0000</pubDate>
		<dc:creator>bill</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[Web design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://techrageo.us/2007/04/07/php-and-wordpress-svg-basics/</guid>
		<description><![CDATA[Scalable Vector Graphics, or SVG, is an XML standard for vector graphics (of course). That means that it contains descriptions of shapes, such as rectangles, lines, circles, and text, in an XML format. SVG provides a robust definition language for drawings. The drawing at the right was a sample SVG drawing included in Jasc&#8217;s WebDraw. [...]]]></description>
			<content:encoded><![CDATA[<p><img align="right" src="/wp-content/code/svgbutterfly.jpg"/>Scalable Vector Graphics, or SVG, is an XML standard for vector graphics (of course). That means that it contains descriptions of shapes, such as rectangles, lines, circles, and text, in an XML format.</p>
<p>SVG provides a robust definition language for drawings. The drawing at the right was a sample SVG drawing included in Jasc&#8217;s WebDraw. There are many other examples on the web of complex SVG drawings.</p>
<p>I&#8217;ve been playing around with SVG just a bit and thought I&#8217;d record the basics of getting simple shapes embedded in a page and how to do it with PHP and in WordPress.</p>
<p>Grant posted an article here a couple years ago on creating <a href="http://techrageo.us/2005/06/22/svg-graphs-with-php/">SVG Graphs With PHP</a>, so check that out too if you want a more complicated example.</p>
<h3>SVG in HTML</h3>
<p>The simplest way to get SVG vector drawings in an HTML file is to embed an .svg file. The HTML and SVG source will look something like the following</p>
<p><strong>HTML Code</strong><br />
<code><br />
&lt;html&gt;<br />
&lt;body&gt;<br />
Circle In A Square&lt;br/&gt;<br />
&lt;embed width="100" height="100" src="/wp-content/code/phpsvg1.svg"/&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<p><strong>SVG Code</strong><br />
<code><br />
&lt;?xml version="1.0"?&gt;<br />
&lt;svg width="100px" height="100px" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"&gt;<br />
	&lt;rect x="10" y="10" width="50" height="50"<br />
		fill="#777" stroke="red" stroke-width="3"  /&gt;<br />
	&lt;circle cx="16" cy="16" r="8" fill="black" stroke="yellow" stroke-width="3"/&gt;<br />
&lt;/svg&gt;<br />
</code></p>
<p><strong>Output</strong></p>
<p>Circle In A Square<br />
<embed width="100" height="100" src="/wp-content/code/phpsvg1.svg"/></p>
<h3>WordPress and SVG</h3>
<p>To include an SVG drawing in a WordPress post, simply create and upload an SVG file then put the HTML EMBED tag in your WordPress post.<br />
<code><br />
&lt;embed width="100" height="100" src="/wp-content/code/phpsvg1.svg"/&gt;<br />
</code></p>
<h3>Basic SVG Tags</h3>
<p>There are plenty of exhaustive SVG references on the web, so let&#8217;s look at just the tags used above.</p>
<div style="padding-left:10px">
<p><strong>svg</strong> &#8211; This tag indicates the beginning of an SVG drawing. The attibutes used above are width and height, both self-<br />
describing, viewBox which describes a clipping rectangle for the drawing, and xmlns which simply defines the default namespace for<br />
the XML tags used in the drawing.</p>
<p><strong>rect</strong> &#8211; Here we define the rectangle, with x and y being the upper-left corner, width and height again are obvious, fill<br />
is the rectangle&#8217;s color in hex digits, stroke is the color of the line used to draw the outside boundary of the rectangle, and<br />
stroke-width is the width of that line.</p>
<p><strong>circle</strong> &#8211; This defines the circle. cx and cy determine the center point of the circle, while r is the radius; fill,<br />
stroke, and stroke-width have the same meanings as was used for the rectangle.</p>
</div>
<h3>PHP SVG</h3>
<p>Of course, outputting SVG from PHP requires that you output the SVG source back to the browser. However, PHP output will normally be marked as being of <em>Content-Type: text/html</em>, so you have to do two things to send back SVG:
<ol>
<li>First, set the Content-Type header to <em>image/svg+xml</em></li>
<li>Second, make sure your php file does not contain any text outside the script tags.</li>
</ol>
<p>So, the following PHP generates the above SVG drawing.<br />
<code><br />
&lt;?php<br />
$svg = &lt;&lt;&lt;END<br />
&lt;?xml version="1.0" standalone="no"?&gt;<br />
&lt;svg width="100px" height="100px" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"&gt;<br />
	&lt;rect x="10" y="10" width="50" height="50"<br />
		fill="navy" stroke="red" stroke-width="3"  /&gt;<br />
	&lt;circle cx="16" cy="16" r="8" fill="black" stroke="yellow" stroke-width="3"/&gt;<br />
&lt;/svg&gt;<br />
END;<br />
header("Content-Type: image/svg+xml");<br />
echo $svg;<br />
?&gt;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://techrageo.us/2007/04/07/php-and-wordpress-svg-basics/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

