Jump to content
Software FX Community

data to map


gaurav

Recommended Posts

can u please tell me why the data is not being reflected into the map..... the code is as follows

string mySelectQuery = "select countryname,sum(ElectricityUse)as electricity from AcctRptdata,country where IdCountryCode=countrycode group by countryname";   SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=DEMO_2;Integrated Security=SSPI");   conn.Open();   SqlDataAdapter adapter = new SqlDataAdapter();   DataSet ds = new DataSet();   adapter.SelectCommand = new SqlCommand(mySelectQuery, conn);   adapter.Fill(ds,"AcctRptData,country");     chart1.DataSourceSettings.Fields.Add(new FieldMap("countryname", FieldUsage.Label));   chart1.DataSourceSettings.Fields.Add(new FieldMap("electrcity", FieldUsage.Value));   chart1.DataSource = ds.Tables[0];   chart1.ConditionalAttributes.Clear();   ConditionalAttributes condition1 = new ConditionalAttributes();   ConditionalAttributes condition2 = new ConditionalAttributes();   condition1.Condition.To = 1400000;   condition1.Color = Color.Green;   condition2.Color = Color.Red; condition2.Condition.From = 1400001;   condition2.Condition.To = 7200000;   chart1.ConditionalAttributes.Add(condition1);   chart1.ConditionalAttributes.Add(condition2);   chart1.ConditionalAttributes.Recalculate();   conn.Close();

Link to comment
Share on other sites

Hello,First I would confirm that in fact your Map1 extension connecting to your Chart.I came across with the same issue several days ago, and here is the code that solved the issue. In my case my issue was around adapter.Fill(ds); CFXMap.Data.Clear();//SettingsCFXMap.LegendBox.Visible = true;CFXMap.LegendBox.Dock = DockArea.Bottom;CFXMap.LegendBox.ItemAttributes[CFXMap.ConditionalAttributes].Visible = true;//this hides last label and shows NO DATA AVAILABLECFXMap.LegendBox.ItemAttributes[CFXMap.Series].Visible = false; string maskString = "Average: " + "%v";CFXMap.ToolTipFormat = maskString;CFXMap.AxisY.DataFormat.Decimals = 2;CFXMap.Width = 500;try{//Temperature (I have deleted 2007 info) CFXMap.Titles[0].Text = "Average " + RadioTemp.Text + " for " + SelectYear.Text;m_condListT = CFXMap.ConditionalAttributes;m_condListT.Clear();ConditionalAttributes condT1 = new ConditionalAttributes();condT1.Condition.To = 30;condT1.Color = Color.FromArgb(70, 131, 204);condT1.Text = "Under 30";ConditionalAttributes condT2 = new ConditionalAttributes();condT2.Condition.From = 30.01;condT2.Condition.To = 40;condT2.Color = Color.FromArgb(155, 201, 222);condT2.Text = "30 to 40";m_condListT.AddRange(new ConditionalAttributes[] { condT1, condT2});m_condListT.Recalculate();

//Query for TemperatureSQLString = "SELECT temperature.ave, states.code FROM (temperature INNER JOIN states ON temperature.state = states.id) WHERE (states.id<100 AND temperature.[year] = " + SelectYear.SelectedValue + ")";string dataPath = Path.Combine(Application.StartupPath, "weather.mdb");string myConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0};", dataPath);System.Data.OleDb.OleDbConnection myConnection = new System.Data.OleDb.OleDbConnection(myConnectionString);System.Data.DataSet ds = new System.Data.DataSet();System.Data.OleDb.OleDbDataAdapter adapter = new System.Data.OleDb.OleDbDataAdapter(SQLString, myConnection);\adapter.Fill(ds,"MapData");//Bind the chart to the dataset CFXMap.DataSource = ds.Tables["MapData"];//Set DetailLevel to the first level (Regions)map1.DetailLevel = 0;map1.LabelStylesSettings.ShowThisLevelOnly = true;//map1.Recalculate();CFXMap.Refresh();
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...