1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SELECT 
    DATE_FORMAT(m1, '%Y-%m') AS standardDate
FROM(
    SELECT 
        ('2020-01-11' - INTERVAL DAYOFMONTH('2020-01-11')-1 DAY) +INTERVAL m MONTH as m1
    FROM(
        SELECT @rownum:=@rownum+1 as m FROM
        (SELECT 1 union SELECT 2 union SELECT 3 union SELECT 4) t1,
        (SELECT 1 union SELECT 2 union SELECT 3 union SELECT 4) t2,
        (SELECT 1 union SELECT 2 union SELECT 3 union SELECT 4) t3,
        (SELECT 1 union SELECT 2 union SELECT 3 union SELECT 4) t4,
        (SELECT @rownum:=-1) t0
    ) d1
) d2 
WHERE m1 <= '2020-09-30' 
ORDER BY m1
cs

 

참고 : stackoverrun.com/ko/q/4011597

 

mysql에서 두 날짜 사이의 월 목록을 얻는 방법

mysql에서 두 날짜 사이의 월 목록을 가져 왔습니다. For Example:My Input is From date 23-01-2013 To Date 01-04-2014 Output Should be Jan 2013, Feb 2013, March 2013, . . . Jan 2014, Feb 2014, Mar 2014, Apr ...

stackoverrun.com

 

 

Posted by 셋부터넷
,

예제)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
function(chartData) {
    Highcharts.chart('monitoringDonutChart', {
        credits: {
            enabled: false,
            position: {
                align: 'center',
                verticalAlign: 'middle'
            }
        },
        chart: {
            height: 250,
            width: 300,
            marginTop:  null,
            margin: null,
            animation: true,
            events: {
                load: function() {
                    var chart = this,
                    value = 0;
                    chart.series[0].yData.forEach(function(point, index) {
                        if(index == 0){
                            value += point;
                        }
                    });
                    
                    //파이챠트 중간에 텍스트 추가 후 상,하 센터정렬
                    chart.renderer.text(value, nullnull, chart.resetZoom, {
                        }).attr({
                           align: 'center',
                           verticalAlign: 'middle'
                        }).add().css({fontSize: '20px'}).align({
                           align: 'center',
                           verticalAlign: 'middle',
                           x: 0,
                           y: 0
                        }, falsenull);
                    
                }
            }
        },
        title: { 
            enabled: false,
            useHTML:true,
            text: null,
            verticalAlign: 'bottom'
        },
        plotOptions: {
            pie: {
                dataLabels: {
                    enabled: false
                },
                animation: false,
                showInLegend: true
            },
        },
        legend: {
            enabled: false
        },
        series: [{
            name'사용량',
            type: 'pie',
            innerSize: '75%',
            colors: ['#ffcc00''#c0c0c0'],
            data: chartData
        }, ],
    });
}
cs

 

참고)

- 도넛형태 : stackoverflow.com/questions/54434360/aligning-labels-in-highchart-donut

 

Aligning labels in highchart donut

I'm trying to make a highchart donut with a legend on the side, I'm really struggling to get the data labels to be more centered. At the moment each of them are in a different place, an image of

stackoverflow.com

- 중간에 텍스트삽입 : stackoverflow.com/questions/38072913/how-to-add-text-via-chart-renderer-text-in-highcharts

 

How to add text via chart.renderer.text in Highcharts?

I have succeeded adding additional text to my charts, like here. This, I achieved through adding a "function(chart)" to my "var chart = new Highcharts.Chart" $.get('xxx.csv', function(data) { ...

stackoverflow.com

 

- 가운데 정렬 : stackoverflow.com/questions/22310677/add-buttons-in-chart-of-highcharts-at-runtime

 

Add buttons in chart of Highcharts at runtime

I need to add some custom buttons (with onclick events), without overwrite the exporting buttons value, 'cause I wanna include new buttons without lost the custom buttons previously defined in cha...

stackoverflow.com

 

 

Posted by 셋부터넷
,

어느날 아래와 같은 구조를  가진 테이블을

 idx

area1 

area2 

area3 

area4 

area5 

 1

 10

20 

30 

40 

50 

 2

 11

21 

31 

41 

51 

 

 

아래와 같이 변경 해야 하는 경우가 닥치고 말았다

no

position 

value 

 1

 area1

 10

 1

 area2

 20

 1

 area3

 30

 1

 area4

 40

 1

 area5

 50

 2

 area1

 11

 2

 area2

 21

 2

 area3

 31

 2

 area4

 41

 2

 area5

 51

 

해결책 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
SELECT
    `no`,
    CASE 
        WHEN x=1 THEN 'area1'
        WHEN x=2 THEN 'area2'
        WHEN x=3 THEN 'area3'
        WHEN x=4 THEN 'area4'
        WHEN x=5 THEN 'area5'
    END `position`,
 
    CASE 
        WHEN x=1 THEN area1
        WHEN x=2 THEN area2
        WHEN x=3 THEN area3
        WHEN x=4 THEN area4
        WHEN x=5 THEN area5
    END `value
FROM (
    select * from default_data a,
    (
        select 1 AS x
        union all select 2 AS x
        union all select 3 AS x
        union all select 4 AS x
        union all select 5 AS x
    ) b
)
ORDER BY `NO`, `NUMBERS` ASC;
cs

 

[출처] Mysql 가로 컬럼 형태를 세로 rows 형태 로 변경|작성자 RS

Posted by 셋부터넷
,