Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET PDF Chart export , +
Hi ,
 
I have a requirement to export the chart to Excel and PDF.
 
I can able to export the chart with 2 axis to pdf using itextsharp and SQLDATASOURCE. The thing is I have 3 axis(X,Y,Secondary Y) Chart so I couldn't able to export the chart to PDF/Excel.And I am using Sql server 2008 to pull values for chart axis.
 
Can anyone please guide me on this..its ruin my head Frown | :(
 
Thanks in Advance.
Posted 9-Apr-13 3:49am
Comments
Member 2707515 at 9-Apr-13 9:06am
   
means u want to create a pie daigram
venkatesun at 16-Apr-13 2:28am
   
any kind of chart with 3 axis but no 3D :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Imports System.Web.UI.DataVisualization
Imports System.Web.UI.DataVisualization.Charting
 
Dim srs As Series = chtTotal.Series.Add("srsTotal")
        Dim lgn As Legend = chtTotal.Legends.Add("legTotal")
        Dim ds As DataSet = Bugs.GetCallListForReviewChartPie(Session("user_id"), lblClients.Text, txtFromDate.Text, txtToDate.Text)
        If ds.Tables(0).Rows.Count > 0 Then
            chtTotal.DataSource = ds.Tables(0)
 
            lgn.LegendStyle = LegendStyle.Table
            lgn.Alignment = StringAlignment.Center
            lgn.Docking = Docking.Bottom
 
            srs.ChartType = SeriesChartType.Pie
            srs.ShadowOffset = 2
            srs.Font = New Font("Times New Format", 7.0F)
            srs.IsValueShownAsLabel = True
            Dim yValues(1) As Integer
            Dim xValues(1) As String
 
            For j As Integer = 0 To ds.Tables(0).Rows.Count - 1
                xValues(j) = ds.Tables(0).Rows(j).Item("Category")
                If ds.Tables(0).Rows.Count = 1 Then
                    xValues(j + 1) = IIf(ds.Tables(0).Rows(j).Item("Category") = "CR", "PR", "CR")
                End If
            Next
            For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
                yValues(i) = ds.Tables(0).Rows(i).Item("Total")
            Next
 
            srs.Points.DataBindY(yValues)
            For pointIndex As Integer = 0 To srs.Points.Count - 1
                srs.Points(pointIndex).LegendText = xValues(pointIndex)
                srs.Points(pointIndex).ToolTip = xValues(pointIndex) & " (" & yValues(pointIndex) & ")"
                srs.Points(pointIndex).LegendToolTip = xValues(pointIndex) & " (" & yValues(pointIndex) & ")"
            Next
 

            srs.PostBackValue = "#INDEX"
            srs.LegendPostBackValue = "#INDEX"
            srs.Points(0).Font = New Font("Times New Format", 7.0F)
            chtTotal.Series("srsTotal").SetCustomProperty("PieLabelStyle", "Disabled")
 
            For pointIndex As Integer = 0 To srs.Points.Count - 1
                If yValues(pointIndex) = "0" Then
                    srs.Points(pointIndex).PostBackValue = ""
                    srs.Points(pointIndex).LegendPostBackValue = ""
                End If
            Next
 
            If Not txtID.Text = "" Then
                srs.Points(IIf(txtID.Text = "PR", 1, 0)).Font = New Font("Times New Format", 9.0F, FontStyle.Bold)
                srs.Points(IIf(txtID.Text = "PR", 1, 0)).BorderColor = Color.Black
                srs.Points(IIf(txtID.Text = "PR", 1, 0)).BorderWidth = 4
            End If
 
            chtTotal.Width = 500
 
            If File.Exists(tmpChartName) Then File.Delete(tmpChartName)
            chtTotal.SaveImage(tmpChartName, ChartImageFormat.Png)
            chtTotal.Legends.RemoveAt(0)
 
            chtTotal.Width = 200
        Else
            chtTotal.Visible = False
            Session("Message") = "No Records."
            Master.ShowMessage()
        End If
 
i create dynamically, this with the help of mschart.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

My charts automatically exported into a file. I don't know how to solve that problem. Because export coding is not included in my application.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 169
1 George Jonsson 145
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 28 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100