User (Legacy) Posted September 3, 2003 Report Posted September 3, 2003 I would like to have two Y axis. Currently I have a graph that displayes dolar value over time. I would like to add percent over time. I have looked at the bellow code example but do not understand how to apply it to datasets and Cross Tab. I have also included my function below the book example. Please advice. //Populating the chart1 chart1.OpenData(SoftwareFX.ChartFX.COD.Values,2,5); chart1.Value[0,0]=0.5; chart1.Value[0,1]=0.75; chart1.Value[0,2]=0.91; chart1.Value[0,3]=0.98; chart1.Value[0,4]=0.72; chart1.Value[1,0]=232815; chart1.Value[1,1]=678192; chart1.Value[1,2]=655234; chart1.Value[1,3]=891230; chart1.Value[1,4]=533988; chart1.CloseData (SoftwareFX.ChartFX.COD.Values); SoftwareFX.ChartFX.Internet.Server.SeriesAttributes series0 = chart1.Series[0]; SoftwareFX.ChartFX.Internet.Server.SeriesAttributes series1 = chart1.Series[1]; series0.Gallery = SoftwareFX.ChartFX.Gallery.Area; series1.Gallery = SoftwareFX.ChartFX.Gallery.Bar; series1.CylSides = 32; series0.YAxis = SoftwareFX.ChartFX.YAxis.Secondary; SoftwareFX.ChartFX.Internet.Server.Axisaxis = chart1.Axis[(int)SoftwareFX.ChartFX.YAxis.Secondary]; axis.Min =0.5; axis.Max = 1; axis.Step = 0.05; axis.Visible = true; axis.TextColor =Color.Blue; axis.Grid.Color =Color.Blue; chart1.AxisY.Gridlines = true; MY CODE /// <summary> /// Loads a hardcoded chartFX object with the YTD perfomance graph and risk ratio. /// </summary> /// <param name="mm_id"> The mm_id of the manager to be displayed. /// If set to 0 then the firm satistics are loaded. /// </param> private void loadEquityPerformanceGraph(Int32 mm_id) { //Get the equity growth graph for selected manager. SqlConnection sqlConnectionACE = new SqlConnection(ConfigurationSettings.AppSettings.Get("ACEConnectionString")); sqlConnectionACE.Open(); SqlCommand sqlCommand_pr_mm_eqty_perf = new SqlCommand("pr_perfsummary_graph", sqlConnectionACE); sqlCommand_pr_mm_eqty_perf.CommandType = CommandType.StoredProcedure; sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@mm_id", mm_id)); sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@accttype_cd", "ALL")); sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@from_dte", "1-1-2003")); sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@to_dte", DateTime.Now)); SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand_pr_mm_eqty_perf); DataSet ds = new DataSet("equityPerformanceGraph"); adapter.Fill(ds); /*************** * DATASET THAT I WOULD LIKE TO ADD ON A DIFFERENT AXIS. //Get the risk ratio graph for selected manager. SqlConnection sqlConnectionACE = new SqlConnection(ConfigurationSettings.AppSettings.Get("ACEConnectionString")); sqlConnectionACE.Open(); SqlCommand sqlCommand_pr_mm_eqty_perf = new SqlCommand("pr_riskratio_graph", sqlConnectionACE); sqlCommand_pr_mm_eqty_perf.CommandType = CommandType.StoredProcedure; //sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@mm_id", mm_id)); //sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@accttype_cd", "ALL")); //sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@from_dte", "1-1-2003")); //sqlCommand_pr_mm_eqty_perf.Parameters.Add(new SqlParameter("@to_dte", DateTime.Now)); SqlDataAdapter adapter = new SqlDataAdapter(sqlCommand_pr_mm_eqty_perf); DataSet ds2= new DataSet("equityPerformanceGraph"); adapter.Fill(ds2; */ //************************* Chart FX Stuff ************************** //Cross Tab Junk: DataTableProvider dt3 = new DataTableProvider(ds.Tables[0]); //SoftwareFX.ChartFX CrosstabDataProvider cfxCT3 = new CrosstabDataProvider(); cfxCT3.DataType[0] = SoftwareFX.ChartFX.Data.CrosstabDataType.ColumnHeading; cfxCT3.DataType[1] = SoftwareFX.ChartFX.Data.CrosstabDataType.RowHeading; cfxCT3.DataType[2] = SoftwareFX.ChartFX.Data.CrosstabDataType.Value; cfxCT3.DataType[3] = SoftwareFX.ChartFX.Data.CrosstabDataType.NotUsed; cfxCT3.DataSource = dt3; //cFXGraph.AxisX.Style = cFXGraph.AxisX.Style Or AxisStyle.ShowEnds //cFXGraph.AxisX.Step = 1000 //Normal stuff. equityPerformanceGraph.DataType[0] = SoftwareFX.ChartFX.DataType.Label; equityPerformanceGraph.DataType[1] = SoftwareFX.ChartFX.DataType.Label; equityPerformanceGraph.DataType[2] = SoftwareFX.ChartFX.DataType.Value; equityPerformanceGraph.DataType[3] = SoftwareFX.ChartFX.DataType.NotUsed; //cFXGraph.AxisX.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.Date; equityPerformanceGraph.AxisY.LabelsFormat.Format = SoftwareFX.ChartFX.AxisFormat.Currency; //cFXGraph.AxisX.LabelsFormat.CustomFormat = "h:mm"; //cFXGraph.AxisX.LabelAngle = 45 equityPerformanceGraph.LeftGap = 5; equityPerformanceGraph.TopGap = 15; equityPerformanceGraph.BottomGap = 15; //cFXGraph.DataSource = ds equityPerformanceGraph.DataSourceSettings.DataSource = cfxCT3; //cFXGraph.DataBind() ' //SoftwareFX.ChartFX.Flash.FlashWriter(fw = New SoftwareFX.ChartFX.Flash.FlashWriter) //**************** FLASH **************************** FlashWriter fw = new FlashWriter(); equityPerformanceGraph.OutputWriter = fw; //*************************************************** sqlConnectionACE.Close(); }
Software FX Posted September 3, 2003 Report Posted September 3, 2003 Simply add the following code BEFORE you pass the data to the chart: SoftwareFX.ChartFX.Internet.Server.SeriesAttributes series1 = chart1.Series[1]; series1.YAxis = SoftwareFX.ChartFX.YAxis.Secondary; This is assuming you want to attach the second series (1) to the secondary Y-Axis, if this is no the case modify appropriatelly. -- FP Software FX, Inc.
User (Legacy) Posted September 4, 2003 Author Report Posted September 4, 2003 Thanks for the reply. I think I understand what you are saying as far as series go but I use datasets and the below syntax on series. (See original e-mail for full syntax) To complicate it further I use cross tab. Perhaps the question that I should be asking is how do I make the cross tab dataset into a series. --------------- DataTableProvider dt3 = new DataTableProvider(ds.Tables[0]); CrosstabDataProvider cfxCT3 = new CrosstabDataProvider(); equityPerformanceGraph.DataSourceSettings.DataSource = cfxCT3; "SoftwareFX Support" <support@softwarefx.com> wrote in message news:9gWtarlcDHA.3340@WEBSERVER1... > Simply add the following code BEFORE you pass the data to the chart: > > SoftwareFX.ChartFX.Internet.Server.SeriesAttributes series1 = > chart1.Series[1]; > > series1.YAxis = SoftwareFX.ChartFX.YAxis.Secondary; > > This is assuming you want to attach the second series (1) to the secondary > Y-Axis, if this is no the case modify appropriatelly. > > -- > FP > Software FX, Inc. > >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.