Jump to content
Software FX Community

Please Help with the UserLegendBox in a Map


espranzani

Recommended Posts

I've been working with a pretty simple map.  It is the World Countries SVG.  I pass a number in for certain countries and using ConditionalAttributes, it displays the countries in different colors depending on where the number for the country falls in the conditional ranges.

 When the user legend is generated, it looks fine.  My issue is that each legend item is clickable and I don't want it to be.  When you click on it, it seems to perform a postback.  As I don't have any function at this time for that postback to perform, I don't want them to be clickable at all.  I have scoured the documentation and searched the forums and have not been able to figure out how to turn this functionality off.

 Any help would be much appreciated.

 Thanks!

Liz

Link to comment
Share on other sites

  • 1 month later...

Hi Frank.  I already thought of this and spent a lot of time trying to see if either I was doing it somehow, or if I needed to turn off some default, but have not been able to find anything.

 Here my binding method.  If you could peruse it and see if anything jumps out at you, that would be fantastic.  My company has currently purchased ChartFX 6.2 for .net and they are holding off purchasing the extensions package until we know that we can do everything we want without any issues.

 Thanks again.  Liz

public void BindPage()

{

string mapSource = "C:\\Program Files\\ChartFX for .NET 6.2\\Extensions\\Maps\\Library\\World\\WorldCountries.svg";

SEMReport report = SEMReportDB.GetSEMReportByID(sEMReportID);

if (report!=null)

{

if (report.GeoLocationType==SEMReport.USSTATES)

mapSource = "C:\\Program Files\\ChartFX for .NET 6.2\\Extensions\\Maps\\Library\\US\\USA-States.svg";

}

TrafficTrendCollection items = TrafficTrendDB.GetTrafficTrends(" and sem_SEMReportID="+sEMReportID.ToString()+" and TrafficTrendType='"+TrafficTrend.GEOLOCATION+"' ","NumVisits desc");

 

if (items.Count==0)

this.Visible = false;

else

{

this.Visible = true;mapItem.Visible = true;

mapItem.OpenData(COD.Values, 1, items.Count);

int thisCount = 0;foreach (TrafficTrend item in items)

{

string location = SetGeoLocation(item.Location);

mapItem.Value[0,thisCount] = item.NumVisits;

mapItem.AxisX.Label[thisCount] = location;

thisCount += 1;

}

mapItem.MapSource = mapSource;

mapItem.Width = 575;

mapItem.Height = 330;

SoftwareFX.ChartFX.Borders.ImageBorder myBorder;

myBorder = new SoftwareFX.ChartFX.Borders.ImageBorder(SoftwareFX.ChartFX.Borders.ImageBorderType.Emboss);

mapItem.BackColor = Color.Beige;

mapItem.BorderObject = myBorder;

mapItem.PointLabels = false;

mapItem.SmoothFlags = SmoothFlags.Text;

mapItem.Gaps = new Rectangle(1,1,1,-1);mapItem.LabelStylesSettings.ShowThisLevelOnly = true;

mapItem.DefaultAttributes.Color = Color.BlanchedAlmond;

mapItem.DefaultAttributes.BorderColor = Color.Black;

 

//Map LegendmapItem.UserLegendBox = true;mapItem.UserLegendBoxObj.Continuous = true;

mapItem.UserLegendBoxObj.Docked = Docked.Bottom;

mapItem.UserLegendBoxObj.Alignment = ToolAlignment.Near;

mapItem.UserLegendBoxObj.ToolBorder = ToolBorder.Internal;

mapItem.UserLegendBoxObj.Font = new System.Drawing.Font("Arial", (float) 7);

//Chart Main Title Text, Color, Font

mapItem.Titles[0].Text = "Geo-Tracking";

mapItem.Titles[0].Font = new System.Drawing.Font("Arial", (float) 10, FontStyle.Bold);

mapItem.Titles[0].TextColor = Color.FromArgb(57,128,139);

//Conditional Attributes for colors

m_condList = mapItem.ConditionalAttributes;

m_condList.Clear();

ColorBlender cb = new ColorBlender(Color.FromArgb(194, 217, 249),Color.FromArgb(41, 105, 195), 4);SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes cond1 = new SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes();

cond1.Color = cb.NextColor();

cond1.BorderColor = Color.Black;

cond1.Condition.From = 1;

cond1.Condition.To = 10;

cond1.Legend = "1 - 10";

SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes cond2 = new SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes();

cond2.Color = cb.NextColor();

cond2.BorderColor = Color.Black;

cond2.Condition.From = 11;

cond2.Condition.To = 100;

cond2.Legend = "11 - 100";

SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes cond3 = new SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes();

cond3.Color = cb.NextColor();

cond3.BorderColor = Color.Black;

cond3.Condition.From = 101;

cond3.Condition.To = 999;

cond3.Legend = "101 - 999";

SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes cond4 = new SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes();

cond4.Color = cb.NextColor();

cond4.BorderColor = Color.Black;

cond4.Condition.From = 1000;

cond4.Condition.To = 1000000000;

cond4.Legend = "1000 +";

m_condList.AddRange(new SoftwareFX.ChartFX.Internet.Server.ConditionalAttributes[] { cond1, cond2, cond3, cond4});

mapItem.UserLegendBoxObj.SizeToFit();

mapItem.RecalcScale();

}

}

post-2932-13922400454906_thumb.jpg

Link to comment
Share on other sites

What is? 

<Map:

 I was expecting something like:

<chartfx:Chart id="Chart2" runat="server" Width="656px" Height="480px"></chartfx:Chart>

I'm not sure what you have here. I'm going to need you to create a new project that reproduces the problem, zip it and attach it to your posting.

Link to comment
Share on other sites

Perhaps this is where my problem is stemming from.

When I installed the extension trial, I navigated to the Help & Samples within ChartFX for .NET 6.2:

 C:\Program Files\ChartFX for .NET 6.2\Help & Samples\Samples\Maps

I only found a Window Forms example, so I looked at that and made modifications to it to work with Web Forms.

The object I am using is protected SoftwareFX.ChartFX.Map.Server.Map mapItem;

It seems that this is wrong?  Perhaps before I create a sample project, perhaps you have a better map sample for me to look at, one that uses the Chartfx object instead?

Link to comment
Share on other sites

This is fine. You need a map and a chart. The map is an extension.

The problem you are having doesn't seem  to be a problem with which component you are using, these problems often result in no display at all. You are getting a map so your setup must be correct.

Because you mentioned that clicking in the Custom Legend Box items causes a postback, I suspected that you were attaching to the chart's (not the map) Click event. However, that's the piece of code you haven't sent me yet.

What I need is a Web Form that reproduces the problem in order to determine what's causing this postback.

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...