Jump to content

Variable Chart X-Axis label


Talco

Recommended Posts

I'm doing some statements that will include a variable chart. The chart are column charts and will vary between 1 and 13 different data points.

 

Currently I'm getting the data from an external file. The chart itself is building just fine, but I'm having a couple of issues with the header row.

 

First, if you could take a look at the attached PDF and let me know if it is even possible to have my X-Axis data to print at an angle like their mock up. I'm using FP 6.2, if its not possible on 6.2, is it possible on any of the newer releases?

 

Secondly, Since I'm building the table/chart on the fly I don't know how to create the header row that will be used for the X-Axis on the chart. When I have a <row type="header"> in the code, it only picks up the first variable. My script is using a recordwalker to go through the external file, is it possible to build the header row at the same time?

 

Here is my current code that returns my basic chart.. without any header info.

 

var BHS_Chart = '';

recordWalker=1

while (recordWalker <= numRecsExtBHS)
{
   //Compare the value of the CID field in the current record
   //we are looking at in the external data file to the value
   //of the CustomerID field in the main data file.
var TransID;
TransID = (externalBHS.GetFieldValue(recordWalker, 'AcctNo'));

   if (TransID == Field("AcctNo"))
   {
       BHS_Chart += '<row><cell>'+ NormalizeEntities(externalBHS.GetFieldValue(recordWalker, 'Consumption')) 
       BHS_Chart += '<row><cell>'

      if (recordWalker <= numRecsExtBHS) 
       {
           recordWalker++
           TransID = (externalBHS.GetFieldValue(recordWalker, 'AcctNo'));

           if (TransID == Field("AcctNo"))
           {
               BHS_Chart += '<row><cell>'+ NormalizeEntities(externalBHS.GetFieldValue(recordWalker, 'Consumption')) 
               BHS_Chart += '<row><cell>'
           }

       }
   }
recordWalker++            
//return BHS_Chart;   
}

BHS_Chart += '</table>';
//Print(BHS_Chart);
return BHS_Chart;

Any help would be greatly appreciated. As I'm sure you can tell, my coding knowledge isn't the greatest!

 

Thanks in advance.

Chart_Sample.thumb.jpg.4380a6bfff4b6d65740badc5b46a4fa2.jpg

Link to comment
Share on other sites

First, if you could take a look at the attached PDF and let me know if it is even possible to have my X-Axis data to print at an angle like their mock up. I'm using FP 6.2, if its not possible on 6.2, is it possible on any of the newer releases?

No, you can't print the labels on an arbitrary rotation angle as in your mockup, as least not directly, and there have been no changes to FusionPro's chart generation capabilities since version 6. You could, however, leave the labels off of the chart itself, and then set your own labels in separate text frames with any rotation you want.

Secondly, Since I'm building the table/chart on the fly I don't know how to create the header row that will be used for the X-Axis on the chart. When I have a <row type="header"> in the code, it only picks up the first variable. My script is using a recordwalker to go through the external file, is it possible to build the header row at the same time?

You can set a header by simply adding a row with the <row type=header> tag. Change the first line of your rule to something like this:

var BHS_Chart = "<row type=header><cell>Label 1<cell>Label 2<cell>Label 3";

Adding as many labels as you need.

Link to comment
Share on other sites

Dan, Thanks for the reply.

 

I can't really set the labels on the X-Axis in a separate text frame, the number and position of the labels will vary depending on how many data points the chart has, between 0 & 13. What would you recommend as a way to set this up?

Link to comment
Share on other sites

I can't really set the labels on the X-Axis in a separate text frame, the number and position of the labels will vary depending on how many data points the chart has, between 0 & 13. What would you recommend as a way to set this up?

Sure, you can do this. Since you know how many data points you're adding to the chart in your rule, you could create multiple text frames and programatically populate just the ones you need with JavaScript rules. You could name all the frames and populate just the ones you want from a single rule with the FindTextFrame() function. It's a bit of work to set up, but that's what you'll have to do if you really need the labels to be at an angle.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...