MSChart uses the Double Y axis and mscharty axis.

Source: Internet
Author: User

MSChart uses the Double Y axis and mscharty axis.

Protected void SearchChart () {Chart1.ChartAreas. clear (); Chart1.Series. clear (); ChartArea _ ChartArea = null; Series _ SeriesJRATE = null; Series _ SeriesDRATE = null; Series _ SeriesDCL = null; # Add ChartArea _ ChartArea = new ChartArea () in region loop; // set the main X axis style to ChartArea. axisX. majorGrid. lineColor = System. drawing. color. fromArgb (224,224,224); // color of the primary gridlines on the primary X axis _ ChartArea. axisX. majorGrid. lineDashStyle = ChartD AshStyle. dash; // main X axis main gridline dotted line _ ChartArea. position. auto = true; _ ChartArea. name = "ChartName"; // set ChartName _ ChartArea. axisX. title = ""; // Title of the coordinate of the primary X axis _ ChartArea. axisX. titleAlignment = StringAlignment. far; // The title location of the coordinate of the primary X axis _ ChartArea. axisX. interval = 1; // Interval _ ChartArea. axisX. intervalType = DateTimeIntervalType. number; // specify the Interval Type // _ ChartArea. axisX. labelStyle // set the main Y axis style _ ChartArea. axisY. title = "Commit"; _ ChartArea. axi SY. titleAlignment = StringAlignment. far; _ ChartArea. axisY. majorGrid. lineColor = System. drawing. color. fromArgb (224,224,224); _ ChartArea. axisY. majorGrid. lineDashStyle = ChartDashStyle. dash; // configure the secondary Y axis style _ ChartArea. axisY2.Title = "achievement rate"; _ ChartArea. axisY2.TitleAlignment = StringAlignment. near; _ ChartArea. axisY2.MajorGrid. lineColor = System. drawing. color. fromArgb (224,224,224); _ ChartArea. axisY2.MajorG Rid. lineDashStyle = ChartDashStyle. dash; // _ ChartArea. axisX. labelStyle. interval = 1; // X text Interval // _ ChartArea. axisX. labelStyle. font = new System. drawing. font ("", 12); // _ ChartArea. axisX. majorGrid. interval = 1; // X Main Auxiliary Line Interval // _ ChartArea. axisX. minorGrid. interval = 1; // X secondary Auxiliary Line Interval // _ ChartArea. axisX. minorTickMark. interval = 1; // X secondary dial Interval // _ ChartArea. axisX. majorTickMark. interval = 1; // X primary dial Interval // _ ChartArea. A XisY. minorGrid. interval = 1; // Y secondary Auxiliary Line Interval // _ ChartArea. axisY. majorGrid. interval = 5; // Y Main Auxiliary Line Interval // _ ChartArea. axisY. labelStyle. interval = 0.5; Chart1.ChartAreas. add (_ ChartArea); System. drawing. font F = new Font ("", 16); Title title Title = new Title ("Overall process Statistics", Docking. top, F, Color. black); Chart1.Titles. add (title); title. dockedToChartArea = _ ChartArea. name; title. isDockedInsideChartArea = false; title. alignment = ContentAlignment. topCenter; _ SeriesJRATE = new Series (); _ SeriesJRATE. chartType = SeriesChartType. column; _ SeriesJRATE. name = "Commit"; _ SeriesJRATE. chartArea = _ ChartArea. name; // _ SeriesJRATE. borderColor = System. drawing. color. blue; _ SeriesJRATE. color = Color. blue; _ SeriesJRATE. borderWidth = 1; _ SeriesJRATE. shadowOffset = 1; _ SeriesJRATE. isValueShownAsLabel = true; _ SeriesJRATE. markerStyle = Ma RkerStyle. triangle; _ SeriesJRATE. legendText = "Commit"; _ SeriesJRATE. YAxisType = AxisType. primary; // set as the main Y-axis Chart1.Series. add (_ SeriesJRATE); // Add Series _ SeriesDRATE = new Series (); _ SeriesDRATE. chartType = SeriesChartType. column; _ SeriesDRATE. name = "AvgDate"; _ SeriesDRATE. chartArea = _ ChartArea. name; // _ SeriesDRATE. borderColor = System. drawing. color. green; _ SeriesDRATE. color = Color. green; _ SeriesD RATE. borderWidth = 1; _ SeriesDRATE. shadowOffset = 1; _ SeriesDRATE. isValueShownAsLabel = true; _ SeriesDRATE. markerStyle = MarkerStyle. square; _ SeriesDRATE. legendText = "average workday"; _ SeriesDRATE. XAxisType = AxisType. primary; // set as the Primary X axis Chart1.Series. add (_ SeriesDRATE); // Add Series _ SeriesDCL = new Series (); _ SeriesDCL. chartType = SeriesChartType. spline; _ SeriesDCL. name = "Rate"; _ SeriesDCL. chartArea = _ ChartA Rea. name; // _ SeriesDRATE. borderColor = System. drawing. color. green; _ SeriesDCL. color = Color. yellow; _ SeriesDCL. borderWidth = 1; _ SeriesDCL. shadowOffset = 1; _ SeriesDCL. isValueShownAsLabel = true; _ SeriesDCL. markerStyle = MarkerStyle. square; _ SeriesDCL. legendText = "achievement rate"; _ SeriesDCL. YAxisType = AxisType. secondary; // set it to the Secondary Y axis Chart1.Series. add (_ SeriesDCL); // Add Series # endregion Chart1.Legends [0]. docking = Docking. top; Chart1.Legends [0]. dockedToChartArea = "ChartName"; Chart1.Legends [0]. alignment = StringAlignment. center; Chart1.Legends [0]. isDockedInsideChartArea = false; // 1 No., 'octoken' month, 15.00 Commit, 9.69 average workday, 92.98 achievement rate DataTable dtChart = this. getdt (); if (dtChart! = Null & dtChart. rows. count> 0) {for (int j = 0; j <dtChart. rows. count; j ++) {string YF = dtChart. rows [j] ["month"]. toString (); double dC = double. parse (dtChart. rows [j] ["Commit"]. toString (); double dA = double. parse (dtChart. rows [j] ["average workday"]. toString (); double dD = double. parse (dtChart. rows [j] ["achievement rate"]. toString (); Chart1.Series ["Commit"]. points. addXY (YF, dC); Chart1.Series ["AvgDate"]. points. addXY (YF, dA); Chart1.Series ["Rate"]. points. addXY (YF, dD) ;}} protected DataTable Getdt () {StringBuilder sb = new StringBuilder (); sb. append (@ "select 1 No., 'October 1' month, 15.00 Commit, 9.69 average workday, 92.98 achievement rate from dualunionselect 2 No., 'October 1' month, 15.00 Commit, 11.69 average workday, 86.62 achievement rate from dualunionselect 3 sequence number, 'octoken' month, 15.00 Commit, 9.77 average workday, 95.71 achievement rate from dualunionselect 4 sequence number, 'octoken' month, 15.00 Commit, 10.53 average workday, 90.06 achievement rate From dualunionselect 5 No., 'October 1st 'month, 15.00 Commit, 12.17 average workday, 90.06 achievement rate from dualunionselect 6 No., 'October 1st' month, 15.00 Commit, 10.14 average workday, 100.00 achievement rate from dualunionselect 7 sequence number, 'octoken' month, 15.00 Commit, 0.00 average workday, 0.00 achievement rate from dualunionselect 8 sequence number, 'octoken' month, 15.00 Commit, 0.00 average workday, 0.00 achievement rate from dualunionselect 9 sequence number, '20140901' month, 15.00 Commit, 0.00 average workday, 0.00 achievement rate from dualunionselect 10 sequence number, '20140901' month, 15.00 Commit, 0.00 average workday, 0.00 achievement rate from dualunionselect 11 serial number, '20140901' month, 15.00 Commit, 0.00 average workday, 0.00 achievement rate from dualunionselect 12 serial number, '20140901' month, 15.00 Commit, 0.00 average workday, 0.00 achievement rate from dualunionselect 13 sequence number, 'average' month, 15.00 Commit, 9.14 average workday, 93.85 achievement rate from dual "); DataSet ds = OraHelper. getDateDS (sb. toString (); if (ds! = Null & ds. Tables. Count> 0) {DataTable dtChart = ds. Tables [0]; return dtChart;} else return null ;}

MSChart Double Y axis: Effect

 


MSchart dual Y axis

<Series> <asp: series Name = "Series1" ChartType = "FastLine" Color = "Orange" BorderColor = "Red"> </asp: series>
</Series>
<Series>
<Asp: series Name = "Series2" ChartType = "Column" BorderColor = "Black" Color = "#89BDF0"> </asp: series>
</Series>
<Chartareas> <asp: chartarea Name = "ChartArea1" BorderColor = "64, 64, 64, 64 "BorderDashStyle =" Solid "BackSecondaryColor =" White "BackColor =" Gainsboro "BackGradientStyle =" TopBottom "> <axisy linecolor =" 64, 64, 64, 64 "IsLabelAutoFit =" False "> <labelstyle font =" Trebuchet MS, 8.25pt, style = Bold "/> <majorgrid linecolor =" 64, 64, 64, 64 "/> </axisy> <AxisY2 linecolor =" 64, 64, 64, 64 "IsLabelAutoFit =" False "> <labelstyle font =" Trebuchet MS, 8.25pt, style = Bold "/> <majorgrid linecolor =" 64, 64, 64 "/> </AxisY2>
<Axisx linecolor = "64, 64, 64, 64" IsLabelAutoFit = "False">
<Labelstyle font = "Trebuchet MS, 8.25pt, style = Bold"/>
<Majorgrid linecolor = "64, 64, 64, 64"/>
</Axisx> </asp: chartarea>
</Chartareas>
// Use Primary for the first Series
Chart1.Series [0]. YAxisType = Axis ...... the remaining full text>

Help: In vb60, use the mschart control to draw a picture on the Double Y axis. The values on both sides are different. The main cause is that the values on the right of the Y axis are not painted.

// Add a sequence
Dim series As New Series ("secondSeries ")
Chart. Series. Add (series)
// Set the chart area of the sequence
Series. ChartArea = chart. Series (Default). ChartArea
// Define the Y axis of the sequence as the secondary axis
Series. YAxisType = AxisType. Secondary
In this way, you can process data in the same way as the Y axis of the original sequence.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.