locked
I Need Graphchart Based On My SQL OutPut RRS feed

  • Question

  • User-807418713 posted

    Hello

    I Need Free Licience Graph chart like this below for my asp.net 2.0 C#

    Month Toal Sales
    Jan-18 5000
    Feb-18 8000
    Mar-18 10000
    Apr-18 1200

    Chart will look like this  

    How to do so..

    Monday, July 23, 2018 3:18 PM

Answers

All replies

  • User753101303 posted

    Hi,

    You could consider using for example https://www.chartjs.org/ or you really want to generate an image server side using C# ?

    Monday, July 23, 2018 3:28 PM
  • User-1171043462 posted

    Use ASPChart: Populate Bar and Column Charts from database using ASP.Net Chart control

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Month"), new DataColumn("TotalSales", typeof(int)) });
                dt.Rows.Add("Jan-18", 5000);
                dt.Rows.Add("Feb-18", 8000);
                Chart1.DataSource = dt;
                Chart1.Series[0].ChartType = SeriesChartType.Column;
                Chart1.Legends[0].Enabled = true;
                Chart1.Series[0].XValueMember = "Month";
                Chart1.Series[0].YValueMembers = "TotalSales";
                Chart1.DataBind();
            }
        }
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CS.aspx.cs" Inherits="CS" %>
    
    <%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            body
            {
                font-family: Arial;
                font-size: 10pt;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:Chart ID="Chart1" runat="server" Height="300px" Width="400px">
            <Titles>
                <asp:Title ShadowOffset="3" Name="Items" />
            </Titles>
            <Legends>
                <asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="False" Name="Default"
                    LegendStyle="Row" />
            </Legends>
            <Series>
                <asp:Series Name="Default" />
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1" BorderWidth="0" />
            </ChartAreas>
        </asp:Chart>
        </form>
    </body>
    </html>
    

    Monday, July 23, 2018 3:29 PM
  • User-807418713 posted

    Use ASPChart: Populate Bar and Column Charts from database using ASP.Net Chart control

    protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DataTable dt = new DataTable();
                dt.Columns.AddRange(new DataColumn[2] { new DataColumn("Month"), new DataColumn("TotalSales", typeof(int)) });
                dt.Rows.Add("Jan-18", 5000);
                dt.Rows.Add("Feb-18", 8000);
                Chart1.DataSource = dt;
                Chart1.Series[0].ChartType = SeriesChartType.Column;
                Chart1.Legends[0].Enabled = true;
                Chart1.Series[0].XValueMember = "Month";
                Chart1.Series[0].YValueMembers = "TotalSales";
                Chart1.DataBind();
            }
        }
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CS.aspx.cs" Inherits="CS" %>
    
    <%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            body
            {
                font-family: Arial;
                font-size: 10pt;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:Chart ID="Chart1" runat="server" Height="300px" Width="400px">
            <Titles>
                <asp:Title ShadowOffset="3" Name="Items" />
            </Titles>
            <Legends>
                <asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="False" Name="Default"
                    LegendStyle="Row" />
            </Legends>
            <Series>
                <asp:Series Name="Default" />
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1" BorderWidth="0" />
            </ChartAreas>
        </asp:Chart>
        </form>
    </body>
    </html>

    Hello

    I'm using Asp.net 2.0 C# will this work in asp.net 2.0 C#

    Monday, July 23, 2018 3:33 PM
  • User-369506445 posted

    Hi

    You can use dot net highchart

    http://dotnet.highcharts.com/Highcharts/Demo/Gallery?demo=BarBasic&theme=default

    The hightcgart provide many different type charts. And it easy to config. Also if you want to change your type of chart in the feature, you only have to change the type of the chart, not your other codes

    You can config it for asp.net 2

    Monday, July 23, 2018 3:35 PM
  • User-807418713 posted

    Hello

    I Need Free Licence Graph Chart for Asp.net 2.0 C# 

    Monday, July 23, 2018 3:40 PM
  • User-369506445 posted

    Yes , it 's free for all frameworks such as asp.net 2

    You can get it from nuget

    Here is a good sample for config it

    https://www.c-sharpcorner.com/article/dotnet-highcharts-with-asp-net-mvc/

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 23, 2018 3:47 PM
  • User-1171043462 posted

    Complete example using Chart.js available here

    Create and display Bar Chart in ASP.Net using HTML5, JSON and jQuery

    Yes it is free

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 23, 2018 5:01 PM
  • User1724605321 posted

    Hi Gopi.MCA,

    You can view/select more javascript chart libraries from :

    https://thenextweb.com/dd/2015/06/12/20-best-javascript-chart-libraries/ 

    See License part to make sure it's open source .

    Best Regards,

    Nan Yu

    Tuesday, July 24, 2018 2:55 AM