顯示具有 Chart 標籤的文章。 顯示所有文章
顯示具有 Chart 標籤的文章。 顯示所有文章

2014年7月13日 星期日

[RESOLVED] Code don't display the names of months in the Axis X


Hi there, hope in your help.


Why this code don't display the names of months in the Axis X?


Can you help me?

Thanks in advance.


Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = true;

Chart1.Series.Add("Series1");
Chart1.Series["Series1"].LabelFormat = "#,##";
Chart1.Series["Series1"].XValueMember = "month";
Chart1.Series["Series1"].YValueMembers = "number";

Chart1.Series["Series1"].ChartType = SeriesChartType.Spline;

Chart1.Series["Series1"].IsValueShownAsLabel = true;
Chart1.Series["Series1"].IsValueShownAsLabel = true;

Chart1.Series["Series1"]["ShowMarkerLines"] = "True";
Chart1.Series["Series1"]["ShowMarkerLines"] = "True";

Chart1.Series["Series1"].BorderWidth = 3;
Chart1.Series["Series1"].Color = Color.Red;

Chart1.DataSource = objCmd.ExecuteReader();
Chart1.DataBind();

Chart1.SaveImage(PNG, ChartImageFormat.Png);













http://social.msdn.microsoft.com/Forums/getfile/304564







cms9651







Try changing the AisX interval to 1 as opposed to 5000 in your mark up.



thank you very much!


[RESOLVED] Set MSChart AxixX.Minimum To DateTime


Dear All,


I am binding DateTime values to Chart Control. Everything is working fine. But I want set Minimum And Maximum of AxisX to DateTime value. like


Chart1.ChartAreas[0].AxisX.Minimum=DateTime.Now;

All though Minimum accepts only double value. How I achieve this one. Any suggestion is most valueble in for this post.


Thanks in advance.





Hi,


You can use the DateTime.ToOADate which returns double value.


For more information, please try to refer to the following thread:

http://stackoverflow.com/questions/9790831/having-issues-with-plotting-polar-data-on-a-datetime-x-axis.


#DateTime.ToOADate:

http://msdn.microsoft.com/en-us/library/system.datetime.tooadate.aspx


Hope it can help you.


Best Regards,

Amy Peng 


[RESOLVED] [C# net 4] Culture Info


Hello, hope in your help.


I've this code behind and I need display name of month in italian language.


protected void Page_Load(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("it-IT");

SQL = "SELECT ";
SQL = SQL + " DATE_FORMAT( ";
SQL = SQL + " STR_TO_DATE(Month, '%d/%m/%Y'), ";
SQL = SQL + " '%b, %Y' ";
SQL = SQL + ") AS Month, ";
SQL = SQL + " Number ";
SQL = SQL + " FROM ";
SQL = SQL + " tbl_u ";
SQL = SQL + "ORDER BY ";
SQL = SQL + " YEAR ( ";
SQL = SQL + " STR_TO_DATE(Month, '%d/%m/%Y') ";
SQL = SQL + " ) DESC, ";
SQL = SQL + " MONTH ( ";
SQL = SQL + " STR_TO_DATE(Month, '%d/%m/%Y') ";
SQL = SQL + " ) DESC; ";

try
{
OdbcCommand objCmd = new OdbcCommand(SQL, myConnectionString);
objCmd.CommandType = CommandType.Text;
objCmd.CommandText = SQL;
objCmd.Connection = myConnectionString;

myConnectionString.Open();

....

Chart1.Series["Series1"].XValueMember = "Month";

....

Chart1.DataSource = objCmd.ExecuteReader();
Chart1.DataBind();

}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
myConnectionString.Close();
}
}

I add in code behind the:


Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("it-IT");

and in the aspx page:


<%@ Page Language="C#" Culture="it-IT" UICulture="it-IT" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

But the output for the `month` name is always english.


Can you help me?

Thank you.



I use this to display luglio


Label1.Text = DateTime.Now.ToString("MMMM", CultureInfo.GetCultureInfo("it-IT"));

Maybe you need to format the datetime in aspx page instead in sql



thank you, I tried this but I've error:


OdbcDataReader dr = objCmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
MonthYear = dr["Month"].ToString();
ItalianMonthYear = MonthYear.ToString("MMMM", CultureInfo.GetCultureInfo("it-IT"));
}
}
dr.Close();

Compiler Error Message: CS1501: No overload for method 'ToString' takes 2 arguments





I beleive there is better solution than this


OdbcDataReader dr = objCmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
DateTime dt=new DateTime(DateTime.Now.Year,Convert.ToInt32(dr["Month"]),1);
ItalianMonthYear = dt.ToString("MMMM", CultureInfo.GetCultureInfo("it-IT"));
}
}
dr.Close();







thanks a lot


[RESOLVED] Asp.net clickable chart control


Hi all...


I am new to asp.net . I created a chart control with data binding and it has one series. Now I need the chart to be clickable which navigates to another pages by clicking each area. I found this solution,


                         Chart3.Series["Series1"].Url="EffJaEla.aspx";


But, here all the areas(If it is a column chart, all the columns are navigating to "EffJaEla.aspx" only) are navigatin to one page. I need to navigate to different pages by clicking columns. If the chart is with 4 columns, I need to navigate to 4 pages by
clicking 4 columns. Please help me...



Hi ThiTha,


Microsofts  chart control definitely does support click-through. Check below article out at 4guysfromrolla.


http://www.4guysfromrolla.com/articles/102809-1.aspx


And for more articles please have a look at the threads below


http://archive.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418


http://forums.asp.net/t/1551832.aspx/1


http://forums.asp.net/t/1802726.aspx/1


http://www.advsofteng.com/doc/cdnetdoc/simpleclickable.htm


Hope this helps.


Thanks,


Jatin



here is the similar thread post,


http://forums.asp.net/t/1551832.aspx/1



Hi jats...


Actually I went through these links....but I couldn't find an answere...


Here is my design...


 

         BackColor="64, 64, 0" Palette="Chocolate" onload="Chart2_Load">

            

                

                  LegendText="EFFICIENCY" Palette="BrightPastel">

                 

                


            


            

            

            


            

                

                


            


        




    ConnectionString="<%$ ConnectionStrings:KPIConnectionString1 %>"

    SelectCommand="SELECT [Efficiency], [Fty] FROM [Efficiency_Summery] WHERE ([TransactionDate] = @TransactionDate) ORDER BY [Fty]">

   

    

   


  



There I bind data to the chart.....


then the chart is developped....


Assume I am in a column chart...


I have 4 columns in my chart... I need to click all these columns and navigate to 4 different pages with 4 columns...


Chart3.Series["Series1"].Url="EffJaEla.aspx";


This code navigates to one page by all 4 columns and it does not allow to use 4 urls...


I need to use 4 urls for 4 columns...


Hope you underestood this....


Please help me....



Thanks a lot...




Hi Ijas...


Actually I went through these links....but I couldn't find an answere...


Here is my design...


 

         BackColor="64, 64, 0" Palette="Chocolate" onload="Chart2_Load">

            

                

                  LegendText="EFFICIENCY" Palette="BrightPastel">

                 

                


            


            

            

            


            

                

                


            


        




    ConnectionString="<%$ ConnectionStrings:KPIConnectionString1 %>"

    SelectCommand="SELECT [Efficiency], [Fty] FROM [Efficiency_Summery] WHERE ([TransactionDate] = @TransactionDate) ORDER BY [Fty]">

   

    

   


  



There I bind data to the chart.....


then the chart is developped....


Assume I am in a column chart...


I have 4 columns in my chart... I need to click all these columns and navigate to 4 different pages with 4 columns...


Chart3.Series["Series1"].Url="EffJaEla.aspx";


This code navigates to one page by all 4 columns and it does not allow to use 4 urls...


I need to use 4 urls for 4 columns...


Hope you underestood this....


Please help me....



Thanks a lot...



Hi,


Do you refer the link
http://www.4guysfromrolla.com/articles/102809-1.aspx
? You can set the points url property in the chart control's databound event like this


Protected Sub chtCategoriesProductCount_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles chtCategoriesProductCount.DataBound
For Each point As DataPoint In chtCategoriesProductCount.Series("Categories").Points
Dim categoryId As Integer = point.YValues(1)
point.Url = String.Format("~/Demos/DrillDown/ProductsInCategory.aspx?CategoryID={0}", categoryId.ToString())
...
Next
End Sub

And refer the radchart control:


http://www.telerik.com/community/forums/aspnet-ajax/chart/create-chart-click-event.aspx


Hope it can help you


[RESOLVED] Code don&#39;t display the names of months in the Axis X


Hi there, hope in your help.


Why this code don't display the names of months in the Axis X?


Can you help me?

Thanks in advance.


Chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = true;

Chart1.Series.Add("Series1");
Chart1.Series["Series1"].LabelFormat = "#,##";
Chart1.Series["Series1"].XValueMember = "month";
Chart1.Series["Series1"].YValueMembers = "number";

Chart1.Series["Series1"].ChartType = SeriesChartType.Spline;

Chart1.Series["Series1"].IsValueShownAsLabel = true;
Chart1.Series["Series1"].IsValueShownAsLabel = true;

Chart1.Series["Series1"]["ShowMarkerLines"] = "True";
Chart1.Series["Series1"]["ShowMarkerLines"] = "True";

Chart1.Series["Series1"].BorderWidth = 3;
Chart1.Series["Series1"].Color = Color.Red;

Chart1.DataSource = objCmd.ExecuteReader();
Chart1.DataBind();

Chart1.SaveImage(PNG, ChartImageFormat.Png);













http://social.msdn.microsoft.com/Forums/getfile/304564







cms9651







Try changing the AisX interval to 1 as opposed to 5000 in your mark up.



thank you very much!


[RESOLVED] Set MSChart AxixX.Minimum To DateTime


Dear All,


I am binding DateTime values to Chart Control. Everything is working fine. But I want set Minimum And Maximum of AxisX to DateTime value. like


Chart1.ChartAreas[0].AxisX.Minimum=DateTime.Now;

All though Minimum accepts only double value. How I achieve this one. Any suggestion is most valueble in for this post.


Thanks in advance.





Hi,


You can use the DateTime.ToOADate which returns double value.


For more information, please try to refer to the following thread:

http://stackoverflow.com/questions/9790831/having-issues-with-plotting-polar-data-on-a-datetime-x-axis.


#DateTime.ToOADate:

http://msdn.microsoft.com/en-us/library/system.datetime.tooadate.aspx


Hope it can help you.


Best Regards,

Amy Peng 


[RESOLVED] [C# net 4] Culture Info


Hello, hope in your help.


I've this code behind and I need display name of month in italian language.


protected void Page_Load(object sender, EventArgs e)
{
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("it-IT");

SQL = "SELECT ";
SQL = SQL + " DATE_FORMAT( ";
SQL = SQL + " STR_TO_DATE(Month, '%d/%m/%Y'), ";
SQL = SQL + " '%b, %Y' ";
SQL = SQL + ") AS Month, ";
SQL = SQL + " Number ";
SQL = SQL + " FROM ";
SQL = SQL + " tbl_u ";
SQL = SQL + "ORDER BY ";
SQL = SQL + " YEAR ( ";
SQL = SQL + " STR_TO_DATE(Month, '%d/%m/%Y') ";
SQL = SQL + " ) DESC, ";
SQL = SQL + " MONTH ( ";
SQL = SQL + " STR_TO_DATE(Month, '%d/%m/%Y') ";
SQL = SQL + " ) DESC; ";

try
{
OdbcCommand objCmd = new OdbcCommand(SQL, myConnectionString);
objCmd.CommandType = CommandType.Text;
objCmd.CommandText = SQL;
objCmd.Connection = myConnectionString;

myConnectionString.Open();

....

Chart1.Series["Series1"].XValueMember = "Month";

....

Chart1.DataSource = objCmd.ExecuteReader();
Chart1.DataBind();

}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
myConnectionString.Close();
}
}

I add in code behind the:


Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("it-IT");

and in the aspx page:


<%@ Page Language="C#" Culture="it-IT" UICulture="it-IT" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

But the output for the `month` name is always english.


Can you help me?

Thank you.



I use this to display luglio


Label1.Text = DateTime.Now.ToString("MMMM", CultureInfo.GetCultureInfo("it-IT"));

Maybe you need to format the datetime in aspx page instead in sql



thank you, I tried this but I've error:


OdbcDataReader dr = objCmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
MonthYear = dr["Month"].ToString();
ItalianMonthYear = MonthYear.ToString("MMMM", CultureInfo.GetCultureInfo("it-IT"));
}
}
dr.Close();

Compiler Error Message: CS1501: No overload for method 'ToString' takes 2 arguments





I beleive there is better solution than this


OdbcDataReader dr = objCmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
DateTime dt=new DateTime(DateTime.Now.Year,Convert.ToInt32(dr["Month"]),1);
ItalianMonthYear = dt.ToString("MMMM", CultureInfo.GetCultureInfo("it-IT"));
}
}
dr.Close();







thanks a lot


[RESOLVED] Asp.net clickable chart control


Hi all...


I am new to asp.net . I created a chart control with data binding and it has one series. Now I need the chart to be clickable which navigates to another pages by clicking each area. I found this solution,


                         Chart3.Series["Series1"].Url="EffJaEla.aspx";


But, here all the areas(If it is a column chart, all the columns are navigating to "EffJaEla.aspx" only) are navigatin to one page. I need to navigate to different pages by clicking columns. If the chart is with 4 columns, I need to navigate to 4 pages by
clicking 4 columns. Please help me...



Hi ThiTha,


Microsofts  chart control definitely does support click-through. Check below article out at 4guysfromrolla.


http://www.4guysfromrolla.com/articles/102809-1.aspx


And for more articles please have a look at the threads below


http://archive.msdn.microsoft.com/mschart/Release/ProjectReleases.aspx?ReleaseId=4418


http://forums.asp.net/t/1551832.aspx/1


http://forums.asp.net/t/1802726.aspx/1


http://www.advsofteng.com/doc/cdnetdoc/simpleclickable.htm


Hope this helps.


Thanks,


Jatin



here is the similar thread post,


http://forums.asp.net/t/1551832.aspx/1



Hi jats...


Actually I went through these links....but I couldn't find an answere...


Here is my design...


 

         BackColor="64, 64, 0" Palette="Chocolate" onload="Chart2_Load">

            

                

                  LegendText="EFFICIENCY" Palette="BrightPastel">

                 

                


            


            

            

            


            

                

                


            


        




    ConnectionString="<%$ ConnectionStrings:KPIConnectionString1 %>"

    SelectCommand="SELECT [Efficiency], [Fty] FROM [Efficiency_Summery] WHERE ([TransactionDate] = @TransactionDate) ORDER BY [Fty]">

   

    

   


  



There I bind data to the chart.....


then the chart is developped....


Assume I am in a column chart...


I have 4 columns in my chart... I need to click all these columns and navigate to 4 different pages with 4 columns...


Chart3.Series["Series1"].Url="EffJaEla.aspx";


This code navigates to one page by all 4 columns and it does not allow to use 4 urls...


I need to use 4 urls for 4 columns...


Hope you underestood this....


Please help me....



Thanks a lot...




Hi Ijas...


Actually I went through these links....but I couldn't find an answere...


Here is my design...


 

         BackColor="64, 64, 0" Palette="Chocolate" onload="Chart2_Load">

            

                

                  LegendText="EFFICIENCY" Palette="BrightPastel">

                 

                


            


            

            

            


            

                

                


            


        




    ConnectionString="<%$ ConnectionStrings:KPIConnectionString1 %>"

    SelectCommand="SELECT [Efficiency], [Fty] FROM [Efficiency_Summery] WHERE ([TransactionDate] = @TransactionDate) ORDER BY [Fty]">

   

    

   


  



There I bind data to the chart.....


then the chart is developped....


Assume I am in a column chart...


I have 4 columns in my chart... I need to click all these columns and navigate to 4 different pages with 4 columns...


Chart3.Series["Series1"].Url="EffJaEla.aspx";


This code navigates to one page by all 4 columns and it does not allow to use 4 urls...


I need to use 4 urls for 4 columns...


Hope you underestood this....


Please help me....



Thanks a lot...



Hi,


Do you refer the link
http://www.4guysfromrolla.com/articles/102809-1.aspx
? You can set the points url property in the chart control's databound event like this


Protected Sub chtCategoriesProductCount_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles chtCategoriesProductCount.DataBound
For Each point As DataPoint In chtCategoriesProductCount.Series("Categories").Points
Dim categoryId As Integer = point.YValues(1)
point.Url = String.Format("~/Demos/DrillDown/ProductsInCategory.aspx?CategoryID={0}", categoryId.ToString())
...
Next
End Sub

And refer the radchart control:


http://www.telerik.com/community/forums/aspnet-ajax/chart/create-chart-click-event.aspx


Hope it can help you


[RESOLVED] How to implement Column Bar Chart using Asp.net ?


Hello Everyone,


I have a table with the name "ColumnBarChartTable" as follows,



Column1       Column2        Column3

     A                    B               C

     A                    D               E

     F                    M               L

     N                   O               P

     A                    B               C

     A                    D               H




I want to display these Three columns into Three Bars in the column chart.


But, when i tried following code, the bars are displaying with the first column field values..




       

           

                 

                 


           


           

               

                   

                   


                   

                       

                   


                   

               


           


       


       

   



Can you suggest me how can i seperate three columns of table into three bars of Column Bar Chart.


And how can i bind data to chart control through C# code.(avoiding "asp:SqlDataSource")


Thanks in advance,


Venkata.




[RESOLVED] How to implement Column Bar Chart using Asp.net ?


Hello Everyone,


I have a table with the name "ColumnBarChartTable" as follows,



Column1       Column2        Column3

     A                    B               C

     A                    D               E

     F                    M               L

     N                   O               P

     A                    B               C

     A                    D               H




I want to display these Three columns into Three Bars in the column chart.


But, when i tried following code, the bars are displaying with the first column field values..




       

           

                 

                 


           


           

               

                   

                   


                   

                       

                   


                   

               


           


       


       

   



Can you suggest me how can i seperate three columns of table into three bars of Column Bar Chart.


And how can i bind data to chart control through C# code.(avoiding "asp:SqlDataSource")


Thanks in advance,


Venkata.




[RESOLVED] How to implement Column Bar Chart using Asp.net ?


Hello Everyone,


I have a table with the name "ColumnBarChartTable" as follows,



Column1       Column2        Column3

     A                    B               C

     A                    D               E

     F                    M               L

     N                   O               P

     A                    B               C

     A                    D               H




I want to display these Three columns into Three Bars in the column chart.


But, when i tried following code, the bars are displaying with the first column field values..




       

           

                 

                 


           


           

               

                   

                   


                   

                       

                   


                   

               


           


       


       

   



Can you suggest me how can i seperate three columns of table into three bars of Column Bar Chart.


And how can i bind data to chart control through C# code.(avoiding "asp:SqlDataSource")


Thanks in advance,


Venkata.




[RESOLVED] How to implement Column Bar Chart using Asp.net ?


Hello Everyone,


I have a table with the name "ColumnBarChartTable" as follows,



Column1       Column2        Column3

     A                    B               C

     A                    D               E

     F                    M               L

     N                   O               P

     A                    B               C

     A                    D               H




I want to display these Three columns into Three Bars in the column chart.


But, when i tried following code, the bars are displaying with the first column field values..




       

           

                 

                 


           


           

               

                   

                   


                   

                       

                   


                   

               


           


       


       

   



Can you suggest me how can i seperate three columns of table into three bars of Column Bar Chart.


And how can i bind data to chart control through C# code.(avoiding "asp:SqlDataSource")


Thanks in advance,


Venkata.




[RESOLVED] How to implement Column Bar Chart using Asp.net ?


Hello Everyone,


I have a table with the name "ColumnBarChartTable" as follows,



Column1       Column2        Column3

     A                    B               C

     A                    D               E

     F                    M               L

     N                   O               P

     A                    B               C

     A                    D               H




I want to display these Three columns into Three Bars in the column chart.


But, when i tried following code, the bars are displaying with the first column field values..




       

           

                 

                 


           


           

               

                   

                   


                   

                       

                   


                   

               


           


       


       

   



Can you suggest me how can i seperate three columns of table into three bars of Column Bar Chart.


And how can i bind data to chart control through C# code.(avoiding "asp:SqlDataSource")


Thanks in advance,


Venkata.




[RESOLVED] How to implement Column Bar Chart using Asp.net ?


Hello Everyone,


I have a table with the name "ColumnBarChartTable" as follows,



Column1       Column2        Column3

     A                    B               C

     A                    D               E

     F                    M               L

     N                   O               P

     A                    B               C

     A                    D               H




I want to display these Three columns into Three Bars in the column chart.


But, when i tried following code, the bars are displaying with the first column field values..




       

           

                 

                 


           


           

               

                   

                   


                   

                       

                   


                   

               


           


       


       

   



Can you suggest me how can i seperate three columns of table into three bars of Column Bar Chart.


And how can i bind data to chart control through C# code.(avoiding "asp:SqlDataSource")


Thanks in advance,


Venkata.




[RESOLVED] Chart Control, Minimum Y Interval in Auto Mode


I am using an <asp:Chart
control where the Y axis, which represents an injury count, has the interval set to auto. This works great if there are more than a few injuries (for example, if the maximum value is 92, I have tick marks at 0, 20, 40, 60, and 80. However, if there is only
1 injury, I have tick marks at 0, 0.2, 0.4, 0.6, 0.8, and 1.0. Fractions of an injury do not make sense, so I want to set the minimum interval level to 1. How do I do this?




Hi,


after you fill the series with all the datapoints you can find maximum and minimum from data points and then decide if you want to set the interval to 1.


And refer the similar thread


http://stackoverflow.com/questions/3739370/auto-interval-precision-in-ms-chart


http://stackoverflow.com/questions/10898542/ms-chart-net-how-to-control-axis-interval-in-auto-mode


Hope it can help you



Here is what I did.


'Set Minimum Y Axis Interval to avoid fractional tick marks
If IncidentCount < 2 Then
Me.Chart1.ChartAreas(0).AxisY.Interval = 1
End If


[RESOLVED] C# Charting and text in chartArea


Hello there, I need your help.


I need print in my ChartArea this text extract from the query:


your last statement is the best way

I tried this way but in the ChartArea I've 0 value printed, why?


            Chart1.Series.Add("Series2");
Chart1.Series["Series2"].YValueMembers = "TheMessage";
Chart1.Series["Series2"].IsValueShownAsLabel = true;

Can you help me?

Thank you





In order to display text in chart area you should use this:


Chart1.Titles.Add(new Title("Title 1"));

If you need to display text on your axis, you should not edit YValueMembers as it is used to as data point required to build the chart. Instead try this:


 foreach (Series series in Chart1.Series)
{
foreach (DataPoint point in series.Points)
{ //if non-empty data point
if (point.YValues.Length > 0)
{
point.LegendText = point.AxisLabel;//In case you have legend
point.AxisLabel = "Products";
point.Label = "custom label";
}
}
}







thank you for help, but I don't need print the title of my chart, but in the chartarea the text value extracted from my db.


[RESOLVED] User customisable charts


Hi


Imagine a senario when you have a lot of data in an Sql database.


Has anyone seen/heard/done an asp.net project where the user could choose what selection of data to show in a chart and even choose the type of chart itself?


Let us assume we have in the databse heights, weights, sex and salary of 20 individuals


What I am interested in is allowing the user to choose eg the weights of males vs female and show that as a chart


Or choose a pie chart to show the proportion of males and females in the group


Or...


There are so many different combinations that can further be categorized by a third or fourth variable


Any ready made project that you are aware of o something to recommend that makes building such a project easier?


Regards


ammarhm


[RESOLVED] I tried to create asp.net chart with chart type bubble, but I am getting square blocks instead.


Hi,


I tried to create asp.net chart with chart type bubble, but I am getting square blocks instead of bubbles. I am not getting what I am doing wrong. In the series I added charttype="Bubble". 


Thanks in Advance.,





Hi digish,


Hope the bellow link can help you. It is about changing charttype to bubble programmatically.


http://asp-net-example.blogspot.in/2010/09/how-to-set-change-chart-charttype_22.html



Hi, 


You can set the shape of data points in bubble chart as square, diamond or circle using Series.MarkerStyle property like this,


Chart1.Series("TestSeries").MarkerStyle = MarkerStyle.Circle;
Chart1.Series("TestSeries").ChartType = SeriesChartType.Bubble ;

Hope this helps!





The default Marker style for the Bubble Chart is Square.  Here are your MarkerStyle options:


chrtDemo.Series("Default").ChartType = SeriesChartType.Bubble
chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Circle
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Cross
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Diamond
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Triangle
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Star4
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Star5
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Star6
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Star10
'chrtDemo.Series("Default").MarkerStyle = MarkerStyle.Square


 


[RESOLVED] DataVisualization.Charting Control axis labels font size?


Using the charting control, is there a way to force a certain font size?  I have 6 chart areas and each one seems to render the interval labels in a different font size.  I would like them to all be the same font size.



Are you talking about the labels? if so, click on the chart, under properties look for Label Appearance. Theres the "Font" property where you can define the font type and size. Or you can just add "Font= Times New Roman, 10pt" in the  



Thanks for the idea.  It did make some of them be the same font size.  Unfortunately it didn't work for all of them.  I examined them closer and see that the font size seems to be tied to the number of intervals on the axis.  If there are 6 or less then
it uses the right font but more than that, the font shrinks.   I seem to have bypassed the problem for the moment by removing  Interval="Auto" and giving the chart more height.


[RESOLVED] Snd parameters to chart control (SeriesChartType.Line)


I try to send parameter to chart control. Parmeter source is defined by query string. 


How can I send programmaticaly the parameter from query string to the SqlCommand and to


the Chart1.Series[0].Points.DataBindXY


when I debug I this exception is thrown:


Must declare the scalar variable "@Piezid"



 


 


 


 



Hi,


You can get the value from querystring on PageLoad and set it to SqlCommand such as this,


int PieceID=0;
int.TryParse(Request.QueryString["PieceID"],PieceID);
SqlCommand command = new SqlCommand(commandText, connection);
command.Parameters.Add("@ID", SqlDbType.Int);
command.Parameters["@ID"].Value = PieceID;
//Todo: Execute Command and fill datareader//


Chart1.Series["Series1"].Points.DataBind(
myReader, "Name", "Sales", "Tooltip=Year, Label=Commissions{C2}");

Refer to this to understand Data binding to chart control,


http://blogs.msdn.com/b/alexgor/archive/2009/02/21/data-binding-ms-chart-control.aspx


Please post your code for more help.


Hope this helps!