Sign In  Sign Up Live-Chat

Chart generation question (2)

Last post 05-13-2008, 6:05 PM by elf9210. 13 replies.
Sort Posts: Previous Next
  •  04-17-2008, 7:57 PM 122892

    Chart generation question (2)

    Attachment: Present (inaccessible)

    Hi Aspose.Chart Team,

    I have got another questions regarding the graph chart generation using Aspose.Chart api.

    I have an example graph chart bar that I need to replicate by using Aspose.Chart api.

    I have attached the source example chart bar (file:"example_chart2.jpg") and the my new chart bar that I generated by using Aspose.Chart api (file:"generated_AsposeChart2.jpg").

    My question is,

    1. how do we make the vertical line similar to the source chart bar file? as you can see from the chart bar that generated frmo Aspose.Chart, the vertical line has been cut off.
    2. how to give more space to the x axis number?

    This is the source code:

    Dim chart As Chart = New Chart()
    Dim s As Series = New Series()

    s.ChartType = ChartType.Bar

    s.DataPoints.Add(1, 56)
    s.DataPoints.Add(2, 179)
    s.DataPoints.Add(3, 82)
    s.DataPoints.Add(4, 267)
    s.DataPoints.Add(5, 390)
    s.DataPoints.Add(6, 412)
    s.DataPoints.Add(7, 79)
    s.DataPoints.Add(8, 80)
    s.DataPoints.Add(9, 20)
    s.DataPoints.Add(10, 1330)
    s.DataPoints.Add(11, 2230)
    s.DataPoints.Add(12, 2530)
    s.DataPoints.Add(13, 4230)
    s.DataPoints.Add(14, 2730)
    s.DataPoints.Add(15, 2030)
    s.DataPoints.Add(16, 3230)
    s.DataPoints.Add(17, 3330)
    s.DataPoints.Add(18, 3930)
    s.DataPoints.Add(19, 2930)
    s.DataPoints.Add(20, 1130)
    s.DataPoints.Add(21, 930)
    s.DataPoints.Add(22, 530)
    s.DataPoints.Add(23, 230)
    s.DataPoints.Add(24, 30)

    chart.ChartArea.AxisX.IsMajorGridVisible = False

    chart.ChartArea.AxisY2.IsVisible = False

    chart.ChartArea.AxisX.Title.Text = "Hours of The Day"
    chart.ChartArea.AxisY.Title.Text = "No of Calls"

    chart.ChartArea.AxisX.IsAutoCalc = False
    chart.ChartArea.AxisX.Interval = 1
    chart.ChartArea.AxisX.Minimum = 0
    chart.ChartArea.AxisX.Maximum = 25
    chart.ChartArea.AxisX.IntervalType = IntervalType.Int
    chart.ChartArea.IsMargin = False

    chart.ChartArea.AxisX.MajorTickMark.Length = 0
    chart.SmoothingMode = SmoothingMode.HighQuality

    chart.ChartArea.LegendBox.IsVisible = False

    chart.SeriesCollection.Add(s)
    chart.Height = 238
    chart.Width = 381

    Dim chartBitmap As Bitmap = chart.GetChartImage()

    Thank you.

    Best regards,

    Jarry

     
  •  04-18-2008, 2:55 AM 122925 in reply to 122892

    Re: Chart generation question (2)

    Hi Jarry,

    Thanks for considering Aspose.

    1). Please comment out the line i.e., 'chart.ChartArea.IsMargin = False

    2) Please extend the Width of the chart to give some more space b/w x-axis numbered values.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  04-21-2008, 10:53 PM 123401 in reply to 122925

    Re: Chart generation question (2)

    Attachment: Present (inaccessible)

    Hi Amjad,

    I have commentedout the "chart.ChartArea.IsMargin = False" line and extend the chart width but it still doesn't show the line at the corner (please see attachment file "example_chart2b.jpg" at blue circle)

    This is my new code (I have added some lines for setting up the properties from Roger),

    Dim chart As Chart = New Chart()

    Dim s As Series = New Series()


    s.ChartType = ChartType.Bar

    s.DefaultDataPoint.Color = System.Drawing.Color.FromArgb(255, 0, 0, 0)
    s.DataPoints.Add(1, 56)
    s.DataPoints.Add(2, 179)
    s.DataPoints.Add(3, 82)
    s.DataPoints.Add(4, 267)
    s.DataPoints.Add(5, 390)
    s.DataPoints.Add(6, 412)
    s.DataPoints.Add(7, 79)
    s.DataPoints.Add(8, 80)
    s.DataPoints.Add(9, 20)
    s.DataPoints.Add(10, 1330)
    s.DataPoints.Add(11, 2230)
    s.DataPoints.Add(12, 2530)
    s.DataPoints.Add(13, 4230)
    s.DataPoints.Add(14, 2730)
    s.DataPoints.Add(15, 2030)
    s.DataPoints.Add(16, 3230)
    s.DataPoints.Add(17, 3330)
    s.DataPoints.Add(18, 3930)
    s.DataPoints.Add(19, 2930)
    s.DataPoints.Add(20, 1130)
    s.DataPoints.Add(21, 930)
    s.DataPoints.Add(22, 530)
    s.DataPoints.Add(23, 230)
    s.DataPoints.Add(24, 30)

    chart.ChartArea.AxisX.IsMajorGridVisible = False

    chart.ChartArea.AxisY2.IsVisible = False

    chart.ChartArea.AxisX.Title.Text = "Hours of The Day"
    chart.ChartArea.AxisY.Title.Text = "No of Calls"

    chart.ChartArea.AxisX.IsAutoCalc = False
    chart.ChartArea.AxisX.Interval = 1
    chart.ChartArea.AxisX.Minimum = 0
    chart.ChartArea.AxisX.Maximum = 24
    chart.ChartArea.AxisX.IntervalType = IntervalType.Int

    chart.ChartArea.Margin = 4
    chart.ChartArea.Transparence = 255
    chart.BackColor = System.Drawing.Color.FromArgb(224, 236, 248)
    chart.ChartArea().BackColor = System.Drawing.Color.FromArgb(224, 236, 248)
    chart.ChartArea.AxisX.Color = System.Drawing.Color.Black
    chart.ChartArea.AxisY.Color = System.Drawing.Color.Black

    chart.ChartArea.AxisX.MajorTickMark.Length = 0

    chart.SmoothingMode = SmoothingMode.HighQuality

    chart.ChartArea.LegendBox.IsVisible = False

    chart.SeriesCollection.Add(s)

    chart.Height = 238
    chart.Width = 381

    Dim chartBitmap As Bitmap = chart.GetChartImage()

    Thank you for you helps and Supports.

    Regards,

    Jarry

     
  •  04-21-2008, 11:03 PM 123402 in reply to 123401

    Re: Chart generation question (2)

    Attachment: Present (inaccessible)

    Hi Amjad,

    also, how do you make the body of the bar a bit thiner like in the above example file?

    I have attached the generated graph by using Aspose.Chart (refer to file "generated_AsposeChart2b.jpg")

    Thank you.

    Regards Jarry

     
  •  04-22-2008, 2:14 AM 123424 in reply to 123402

    Re: Chart generation question (2)

    Hi Jarry,

    For "but it still doesn't show the line at the corner"... Well, you have specified the X Axis's Maximum vlaue to 24, so the axis line won't extend more than 24.   

    For "how do you make the body of the bar a bit thiner like in the above example file?"....Do you mean the bars in the chart...yes, if we compare the bars with your desired chart bars, these are slightly thicker. We will look into it soon.

    Thank you.


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  04-23-2008, 1:57 AM 123659 in reply to 123424

    Re: Chart generation question (2)

    Hi Amjad,

    Thanks your reply.

    btw, if I chage the X Axis's Maximum vlaue to 25, then the axis line will show number 25, but i don't want to show 25 in the axis. just up to 24 but the line a little extended to the right, similar to the example graph.

    Is this possible?

    Thanks Amjad.

    Regards,

    Jarry

     
  •  04-23-2008, 2:22 AM 123667 in reply to 123659

    Re: Chart generation question (2)

    Hi Jarry,

    We will look into it and let you know if a solution is devised.

    Thanks for being patient!


    Amjad Sahi
    Support Developer,
    Aspose Nanjing Team
    Contact Us
     
  •  04-23-2008, 8:42 PM 123833 in reply to 123667

    Re: Chart generation question (2)

    Thank you Amjad,

    Regards,

    Jarry

     
  •  05-04-2008, 8:08 PM 125307 in reply to 123833

    Re: Chart generation question (2)

    Hi Amjad,

    any updates on this one?

    Regards,

    Jarry

     
  •  05-12-2008, 1:45 AM 126444 in reply to 125307

    Re: Chart generation question (2)

    Hi Amjad,

    don't worry about this one, i'll log a new thread.

    Thank you.

    regards,

    Jarry

     
  •  05-12-2008, 3:25 AM 126452 in reply to 125307

    Re: Chart generation question (2)

    Attachment: Present (inaccessible)

    Hi,

    The following code is my test using new version.

                Dim chart As Chart = New Chart

                ' Adds a empty stacked bar for get a little space from x axis line

                ' This is not the best solution. Moving x axis down is better, but very complicated

                ' that will chage the whole axis's position, axis labels, tick markers, axis title and so no.

                ' Latter version may be consider implete it. But I doubt is this worth work

                Dim s0 As Series = New Series

                s0.ChartType = ChartType.Bar
                s0.CustomAttributes.IsBarStacked = True

                s0.DataPoints.Add(1, 50)
                s0.DataPoints.Add(2, 50)
                s0.DataPoints.Add(3, 50)
                s0.DataPoints.Add(4, 50)
                s0.DataPoints.Add(5, 50)
                s0.DataPoints.Add(6, 50)
                s0.DataPoints.Add(7, 50)
                s0.DataPoints.Add(8, 50)
                s0.DataPoints.Add(9, 50)
                s0.DataPoints.Add(10, 50)
                s0.DataPoints.Add(11, 50)
                s0.DataPoints.Add(12, 50)
                s0.DataPoints.Add(13, 50)
                s0.DataPoints.Add(14, 50)
                s0.DataPoints.Add(15, 50)
                s0.DataPoints.Add(16, 50)
                s0.DataPoints.Add(17, 50)
                s0.DataPoints.Add(18, 50)
                s0.DataPoints.Add(19, 50)
                s0.DataPoints.Add(20, 50)
                s0.DataPoints.Add(21, 50)
                s0.DataPoints.Add(22, 50)
                s0.DataPoints.Add(23, 50)
                s0.DataPoints.Add(24, 50)

                Dim i As Integer
                For i = 0 To 23 Step i + 1
                    s0.DataPoints(i).BorderColor = Color.Empty
                    s0.DataPoints(i).Color = Color.Empty
                Next

                chart.SeriesCollection.Add(s0)


                Dim s As Series = New Series

                s.ChartType = ChartType.Bar
                s.CustomAttributes.IsBarStacked = True

                s.DefaultDataPoint.Color = System.Drawing.Color.FromArgb(255, 0, 0, 0)
                s.DataPoints.Add(1, 56)
                s.DataPoints.Add(2, 179)
                s.DataPoints.Add(3, 82)
                s.DataPoints.Add(4, 267)
                s.DataPoints.Add(5, 390)
                s.DataPoints.Add(6, 412)
                s.DataPoints.Add(7, 79)
                s.DataPoints.Add(8, 80)
                s.DataPoints.Add(9, 20)
                s.DataPoints.Add(10, 1330)
                s.DataPoints.Add(11, 2230)
                s.DataPoints.Add(12, 2530)
                s.DataPoints.Add(13, 4230)
                s.DataPoints.Add(14, 2730)
                s.DataPoints.Add(15, 2030)
                s.DataPoints.Add(16, 3230)
                s.DataPoints.Add(17, 3330)
                s.DataPoints.Add(18, 3930)
                s.DataPoints.Add(19, 2930)
                s.DataPoints.Add(20, 1130)
                s.DataPoints.Add(21, 930)
                s.DataPoints.Add(22, 530)
                s.DataPoints.Add(23, 230)
                s.DataPoints.Add(24, 30)

                chart.ChartArea.AxisX.IsMajorGridVisible = False

                chart.ChartArea.AxisY2.IsVisible = False

                chart.ChartArea.AxisX.Title.Text = "Hours of The Day"
                chart.ChartArea.AxisY.Title.Text = "No of Calls"

                chart.ChartArea.AxisX.IsAutoCalc = False
                chart.ChartArea.AxisX.Interval = 1
                chart.ChartArea.AxisX.Minimum = 0
                chart.ChartArea.AxisX.Maximum = 24
                chart.ChartArea.AxisX.IntervalType = IntervalType.Int

                chart.ChartArea.Margin = 4
                chart.ChartArea.MarginRight = 20

                ' Point2Offset is new property and is not perfect. Currently, we only use it to extend axis line
                chart.ChartArea.AxisX.Point2Offset = New PointF(15, 0)

                chart.ChartArea.Transparence = 255
                chart.BackColor = System.Drawing.Color.FromArgb(224, 236, 248)
                chart.ChartArea().BackColor = System.Drawing.Color.FromArgb(224, 236, 248)
                chart.ChartArea.AxisX.Color = System.Drawing.Color.Black
                chart.ChartArea.AxisY.Color = System.Drawing.Color.Black

                chart.ChartArea.AxisX.MajorTickMark.Length = 0

                chart.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality

                chart.ChartArea.LegendBox.IsVisible = False

                chart.SeriesCollection.Add(s)

                chart.Height = 238
                chart.Width = 381


    Roger Mo
    Developer
    Aspose Nanjing Team
    Contact Us
     
  •  05-12-2008, 3:29 AM 126453 in reply to 126452

    Re: Chart generation question (2)

    Attachment: Present (inaccessible)

    Hi Jarry,

    Please try the attachment fix. Thank you.


    Roger Mo
    Developer
    Aspose Nanjing Team
    Contact Us
     
  •  05-12-2008, 8:11 PM 126587 in reply to 126453

    Re: Chart generation question (2)

    Attachment: Present (inaccessible)

    Thank you Roger,

    I works Perfectly!

    Btw, is it possible to extend the X-axis MajotTickMark line? (I have attached the example Image).

    Once again, Thank you very much Roger for your Supports and Helps.

    Regards,

    Jarry

     
  •  05-13-2008, 6:05 PM 126788 in reply to 126587

    Re: Chart generation question (2)

    Thank you Roger,

    you have fixed this in forum: "Chart Generation (Question 3)".

    Regards,

    Jarry

     
View as RSS news feed in XML