Dynamic Graphics Issue...complicated...for me anyway

Ask a Question related to Adobe Illustrator Windows, Design and Development.

  1. #1

    Default Dynamic Graphics Issue...complicated...for me anyway

    I have a template that is a map of the united states. Each state on the map is it's own object, all on the same layer. I have data in an access database that holds Avgerage Days in Transit data for shipping companies. For instance it might take an average of 3.4 days to ship from MO to CA. In this case, an outbound map from MO would show a 3.4 next to the CA state label. Same goes for all other states.

    I've got the template setup right now with dynamic text variables for all the state labels. I export from access as an XML file and then I wrote an ASP script to reformat the XML file in a way that Illustrator likes. Then when I attach that reformatted XML file to the map template it will change all the numbers for me. It's great!

    However, there's another step I can't figure out. In this example, CA is a 3.4. All states that are between 3-4 on the map are to be shaded yellow. This part I have not automated...but would love to! Is there a way I can attach the state object to the state lable and have it shade a certain color based on the number?

    Any information would be great! Thanks!
    Andrew_Angell@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Dynamic chart Issue
      Hi guys, In my application, I have two web service for my column chart's datasource,and I have a function when init the column chart but the...
    2. Dynamic 3D cloning issue
      Hi, I'm trying to clone models (that i'm getting from a web server into the cast) into the 3D world but having problems with the state property of...
    3. Another dynamic usercontrol issue
      Hello All, I have a page that dynamically adds one of many usercontrols to a placeholder on the main page based on a parameter passed to the...
    4. ScrollPane issue with dynamic movie
      I have a scroll pane that I load an external swf. This swf has no data in it at all so it is very small in size (width,height). Once loaded into...
    5. Question graphics output of CGIs (mime-type issue?)
      What's the proper way to deliver a grpahical file via HTTP? For example, supposing a web page has a bit of HTML like: <img...
  3. #2

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    I don't think so, but perhaps one of the real gurus here will be able to offer a solution.

    Irrespective of that, though, am I to understand that you have only 48 (OK maybe 49 or 50) separate objects to fill with color? Even manually, one-by-one, layer-by-layer that shouldn't take too long.

    Unless I'm missing something in your explanation, and that you will need to update this map often with different colors. You have the XML and ASP business down for updating the text dynamically, but are your colors going to change as well?
    Phosphor@adobeforums.com Guest

  4. #3

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Yes the data changes constantly. I normally get quarterly updates and the AVG Days in Transit numbers can change drastically at times. There are 336 outbound maps and 336 inboud maps that need changed everytime. The first half that I've explained...getting it to change all the numbers for me...saves me LOTS of time from the way I had to do it before Illustrator 10. I absolutely love it. If I could just figure out the second half I could automate the entire thing and deploy it on a web site where the customer could simply design their map completely and print their own PDF directly from the site.

    Right now I have to change all that manually and then send PDF's to their printing dept. If I can simply automate the entire thing I could simply use the entire solution and actually be able to expand. Right now this one client takes up all my time.

    I'm so close! Any information would be awsome.

    Thanks!
    Andrew_Angell@adobeforums.com Guest

  5. #4

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Sounds like an interesting project.

    Do let us see what you're legally allowed to show us of this site in action when (if?) you get it sussed.
    Phosphor@adobeforums.com Guest

  6. #5

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Hello Andrew -
    did you resolve your issue? I would be interested in your findings. Could you share?
    I am just undertaking a very similar project where I have a map with object on a single layer that I need to change both the contents of the textframes as well as the colors based on data extracted from a database. My program (script) will update the files based on the database and then save as PDF and Email using SMTP.
    TIA.......
    michael
    MichaelRAllen@adobeforums.com Guest

  7. #6

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    This information may be a little late... I only just saw the question...

    With a bit of work you should be able to do this using the fact that you can attach a variable to an object that controls its visibility. I'd do something like the following:

    1) Duplicate all the states (you can select them all, copy and paste in front)

    2) Color the duplicates yellow

    3) Attach visibility variables to all of the original states and to the yellow versions.

    4) Now modify your ASP script to generate XML so that it makes the yellow states visible only when the value is between 3-4 and the original states visible only when it is outside that range.

    By the way, I'm impressed by what you've accomplished.
    Paul_A_George@adobeforums.com Guest

  8. #7

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Andrew,

    I suspect you'll find perhaps a better place for your solution in the Scripting Adobe Applications USER to USER forum. If you do have success, please post back with the outcome.

    Bob
    BobHill@adobeforums.com Guest

  9. #8

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    I appreciate the information. I gues it might help if I give you guys some examples of the maps so you can actually see what I'm working with.

    If you want to take a look at <http://angelleye.no-ip.com/scoutgeo/yellow/> log in with testing:testing and then go into the Custom Maps section. I have samples what the maps look like...and then I have an SVG sample there that I was just playing with that you can show/hide layers and zoom in and out or move around as if you're actually in Illustrator...pretty neat I thought.

    Anyway...as you can see, Yellow isn't the only color that goes on the maps. Would having 4 or 5 different sets of states end up being too large? Or does SVG do a good job of maintaining small file size with something like that? I think I understand what your saying with the idea...and it sounds like it could possibly be the solution I'm looking for. Gonna take some playing with though.

    If you're interested in seeing the scripts that generate my XML for these things let me know. When I export from Access to XML it formats very strangly. Illustrator didn't like the direct file at all. I took a sample from Illustator examples and simply made my ASP script generate the XML and create recordsets. I can do one recordset at a time, or make one large XML file holding ALL recordsets and just pick from a drop down in Illustrator. Solving the state color would be awsome! I'll definitely keep everybody posted.

    Thanks!
    Andrew_Angell@adobeforums.com Guest

  10. #9

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Nice stuff.

    I'm not sure about using 4 or 5 different sets of states. On the SVG export end I think that hidden objects get exported into the SVG so you may find this bloats the file size.

    As suggested, the other alternative is to move to using scripting. You might be able to use a combination of data driven graphics and scripting to accomplish what you want. Data driven graphics will let you import the data and set up the text labels. Scripting could be used to color the states. However, I'm not familiar enough with the details of Illustrator scripting to have any concrete suggestions.
    Paul_A_George@adobeforums.com Guest

  11. #10

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Nice work Andrew. I dont know about VB or Applescript, but I have played with Javascripting support for Adobe, and it is fickle to get working right. It looked to me like your svg preview was on a pretty good track. maybe I'll get slaped off this forum for suggesting it, but have you considered doing this project in Flash? You would get a LOT more flexability with ActionScript, and your file size would be smaller because you could control color dynamically...
    Just a thought... :)
    -J
    john_wundes@adobeforums.com Guest

  12. #11

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    The thing is though, that the final output needs to be for print. The actual solution isn't going to be web based...they print these maps out and using SVG/Adobe would allow me to easily use PDF with my applications.

    Also...I've simply never worked with Flash. Might have to give it a shot. Thanks!
    Andrew_Angell@adobeforums.com Guest

  13. #12

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    Well, its definitely possible to set the color of an item from a script. The following example comes from the illustrator scripting reference at:

    <http://partners.adobe.com/asn/illustrator/scripting.jsp>

    // Example of how to set the stroke and fill of a PathItem.
    // The stroke and fill are set to the colors of a randomly selected swatch

    if ( app.documents.length > 0 &&
    app.activeDocument.pathItems.length > 0 )
    {
    doc = app.activeDocument;
    for ( i = 0; i < doc.pathItems.length; i++ )
    {
    pathRef = doc.pathItems[i];
    pathRef.filled = true;
    pathRef.stroked = true;
    swatchIndex = Math.round( Math.random() * (
    doc.swatches.length - 1 ) );
    pathRef.fillColor = doc.swatches[ swatchIndex ].color;
    pathRef.strokeColor = doc.swatches[ swatchIndex ].color;
    }
    }
    Paul_A_George@adobeforums.com Guest

  14. #13

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    OK, I see Andrew. The "for print" requirement really screws it for using Flash. I wouldn't go there. I've tried exporting eps files from compiled flash swf's and although it is possible, you get some nasty jaggies and seriously imprecise font outlines. It looks like SVG is the way to go for you.

    Paul: Wow, good find! I must have overlooked that section.
    Still, while it looks possible, it would be frustrating as hell trying to set the color of 50 (US state) objects by their relative depth in the document. I wish there were a way to select each object by name! If you can find that in the scripting guide, I think Mr. Angell will have a viable solution.

    I remember when I was writing actions in illustrator 9 there was a way to have illustrator select an object by text entered in the "notes" field in the attributes pallate. Perhaps there is a handle there. I will play with it a bit because I too would like this capability. I'll let you all know what find.
    john_wundes@adobeforums.com Guest

  15. #14

    Default Re: Dynamic Graphics Issue...complicated...for me anyway

    OK, it's not that bad... If you put your state objects on a separate layer, you can access them using Javascript fairly easily.

    This isn't exactly what you want, but it does prove that it is possible to assign a particular instance to a particuar swatch in a complex document. I can send a test .ai file to anyone interested. Otherise, it should be easy enough to make your own.

    // Example of how to set the stroke and fill of a PathItem.
    // This version will walk through the items on level 1 (not 0)
    // and will assign each succesive item (using depth)
    // to the next ascending swatch color.
    // I am skipping the first 4 colors, so if you use the default
    // CS swatch pallate, this script works
    // with up to 56 objects on level 1

    if ( app.documents.length > 0 &&
    app.activeDocument.pathItems.length > 0 )
    {
    doci = app.activeDocument;
    docl = app.activeDocument.layers[1];
    for ( i = 0; i < docl.pathItems.length; i++ ) {

    pathRef = docl.pathItems[i];

    pathRef.filled = true;

    pathRef.stroked = true;

    //swatchIndex = Math.round( Math.random() * (doci.swatches.length - 1 ) );

    pathRef.fillColor = doci.swatches[ i +4].color;

    pathRef.strokeColor = doci.swatches[3].color;

    }

    }
    john_wundes@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139